mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-05 12:24:26 +01:00
Auto force sync
This commit is contained in:
@@ -349,8 +349,13 @@ public class FragmentFolders extends FragmentBase {
|
||||
throw new IllegalStateException(context.getString(R.string.title_no_internet));
|
||||
|
||||
boolean now = true;
|
||||
boolean force = false;
|
||||
boolean outbox = false;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean enabled = prefs.getBoolean("enabled", true);
|
||||
int pollInterval = prefs.getInt("poll_interval", ServiceSynchronize.DEFAULT_POLL_INTERVAL);
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
@@ -371,8 +376,12 @@ public class FragmentFolders extends FragmentBase {
|
||||
outbox = true;
|
||||
else {
|
||||
EntityAccount account = db.account().getAccount(folder.account);
|
||||
if (account != null && !"connected".equals(account.state))
|
||||
if (account != null && !"connected".equals(account.state)) {
|
||||
now = false;
|
||||
if (enabled && !account.ondemand &&
|
||||
(pollInterval == 0 || account.poll_exempted))
|
||||
force = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +390,10 @@ public class FragmentFolders extends FragmentBase {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "refresh/folders");
|
||||
if (force)
|
||||
ServiceSynchronize.reload(context, null, "forced refresh");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "refresh");
|
||||
|
||||
if (outbox)
|
||||
ServiceSend.start(context);
|
||||
|
||||
Reference in New Issue
Block a user