mirror of https://github.com/M66B/FairEmail.git
Force sync improvements
This commit is contained in:
parent
379c06c5fb
commit
f0237b7b67
|
@ -2279,7 +2279,11 @@ class Core {
|
|||
boolean notify_known = prefs.getBoolean("notify_known", false);
|
||||
boolean pro = ActivityBilling.isPro(context);
|
||||
|
||||
EntityLog.log(context, account.name + " POP sync type=" + folder.type + " connected=" + (ifolder != null));
|
||||
boolean force = jargs.optBoolean(5, false);
|
||||
|
||||
EntityLog.log(context, account.name + " POP sync type=" + folder.type +
|
||||
" force=" + force +
|
||||
" connected=" + (ifolder != null));
|
||||
|
||||
if (!EntityFolder.INBOX.equals(folder.type)) {
|
||||
db.folder().setFolderSyncState(folder.id, null);
|
||||
|
@ -2304,7 +2308,8 @@ class Core {
|
|||
: Math.min(imessages.length, account.max_messages));
|
||||
|
||||
boolean sync = true;
|
||||
if (imessages.length > 0 && folder.last_sync_count != null &&
|
||||
if (!force &&
|
||||
imessages.length > 0 && folder.last_sync_count != null &&
|
||||
imessages.length == folder.last_sync_count) {
|
||||
// Check if last message known as new messages indicator
|
||||
MessageHelper helper = new MessageHelper((MimeMessage) imessages[imessages.length - 1], context);
|
||||
|
|
|
@ -374,7 +374,7 @@ public class FragmentAccounts extends FragmentBase {
|
|||
Collections.sort(folders, folders.get(0).getComparator(context));
|
||||
|
||||
for (EntityFolder folder : folders) {
|
||||
EntityOperation.sync(context, folder.id, true);
|
||||
EntityOperation.sync(context, folder.id, true, force);
|
||||
|
||||
if (folder.account == null)
|
||||
outbox = true;
|
||||
|
|
|
@ -394,7 +394,7 @@ public class FragmentFolders extends FragmentBase {
|
|||
Collections.sort(folders, folders.get(0).getComparator(context));
|
||||
|
||||
for (EntityFolder folder : folders) {
|
||||
EntityOperation.sync(context, folder.id, true);
|
||||
EntityOperation.sync(context, folder.id, true, force);
|
||||
|
||||
if (folder.account == null)
|
||||
outbox = true;
|
||||
|
|
|
@ -1580,7 +1580,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
}
|
||||
|
||||
for (EntityFolder folder : folders) {
|
||||
EntityOperation.sync(context, folder.id, true);
|
||||
EntityOperation.sync(context, folder.id, true, force);
|
||||
|
||||
if (folder.account != null) {
|
||||
EntityAccount account = db.account().getAccount(folder.account);
|
||||
|
|
|
@ -1904,8 +1904,15 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
} else {
|
||||
if (folder.poll_count == 0) {
|
||||
// Cancel pending sync, for example when the folder is not set to poll
|
||||
db.operation().deleteOperation(folder.id, EntityOperation.SYNC);
|
||||
EntityOperation.sync(this, folder.id, false);
|
||||
List<EntityOperation> ops = db.operation().getOperations(folder.account, EntityOperation.SYNC);
|
||||
if (ops.size() == 0)
|
||||
EntityOperation.sync(this, folder.id, false);
|
||||
else
|
||||
for (EntityOperation op : ops) {
|
||||
db.operation().deleteOperation(op.id);
|
||||
op.id = null;
|
||||
op.id = db.operation().insertOperation(op);
|
||||
}
|
||||
}
|
||||
folder.poll_count = (folder.poll_count + 1) % folder.poll_factor;
|
||||
db.folder().setFolderPollCount(folder.id, folder.poll_count);
|
||||
|
|
Loading…
Reference in New Issue