Sync folders on manual sync

pull/152/head
M66B 6 years ago
parent 80961856d0
commit 03cd7f927e

@ -320,7 +320,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
} else {
now = "connected".equals(account.state);
EntityOperation.sync(context, db, fid);
EntityOperation.sync(context, db, fid, true);
}
}

@ -185,6 +185,8 @@ class Core {
break;
case EntityOperation.SYNC:
if (jargs.getBoolean(3))
onSynchronizeFolders(context, account, istore, state);
onSynchronizeMessages(context, jargs, account, folder, (IMAPFolder) ifolder, state);
break;

@ -99,15 +99,22 @@ public class EntityOperation {
}
static void sync(Context context, DB db, long fid) {
sync(context, db, fid, false);
}
static void sync(Context context, DB db, long fid, boolean folders) {
if (db.operation().getOperationCount(fid, EntityOperation.SYNC) == 0) {
EntityFolder folder = db.folder().getFolder(fid);
JSONArray jargs = folder.getSyncArgs();
jargs.put(folders);
EntityOperation operation = new EntityOperation();
operation.folder = folder.id;
operation.message = null;
operation.name = SYNC;
operation.args = folder.getSyncArgs().toString();
operation.args = jargs.toString();
operation.created = new Date().getTime();
operation.id = db.operation().insertOperation(operation);

@ -531,7 +531,7 @@ public class FragmentMessages extends FragmentBase {
nointernet = true;
} else {
now = "connected".equals(account.state);
EntityOperation.sync(context, db, folder.id);
EntityOperation.sync(context, db, folder.id, true);
}
}

Loading…
Cancel
Save