|
|
|
@ -495,6 +495,8 @@ public class FragmentMessages extends FragmentBase {
|
|
|
|
|
if (!prefs.getBoolean("enabled", true))
|
|
|
|
|
throw new IllegalStateException(context.getString(R.string.title_sync_disabled));
|
|
|
|
|
|
|
|
|
|
boolean internet = (Helper.isMetered(context, true) != null);
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
try {
|
|
|
|
|
db.beginTransaction();
|
|
|
|
@ -513,14 +515,15 @@ public class FragmentMessages extends FragmentBase {
|
|
|
|
|
boolean now = false;
|
|
|
|
|
for (EntityFolder folder : folders)
|
|
|
|
|
if (folder.account == null) { // outbox
|
|
|
|
|
now = ("connected".equals(folder.state));
|
|
|
|
|
now = (internet && "connected".equals(folder.state));
|
|
|
|
|
EntityOperation.sync(db, folder.id);
|
|
|
|
|
} else {
|
|
|
|
|
now = true;
|
|
|
|
|
EntityAccount account = db.account().getAccount(folder.account);
|
|
|
|
|
if ("connected".equals(account.state))
|
|
|
|
|
if (!internet || "connected".equals(account.state)) {
|
|
|
|
|
now = internet;
|
|
|
|
|
EntityOperation.sync(db, folder.id);
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
now = true;
|
|
|
|
|
db.folder().setFolderSyncState(folder.id, "requested");
|
|
|
|
|
ServiceSynchronize.sync(context, folder.id);
|
|
|
|
|
}
|
|
|
|
|