mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-06 12:54:11 +01:00
Defer download on initialize
This commit is contained in:
@@ -1237,7 +1237,7 @@ class Core {
|
||||
int count = ifolder.getMessageCount();
|
||||
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
|
||||
|
||||
if (download) {
|
||||
if (download && folder.initialize == 0) {
|
||||
db.folder().setFolderSyncState(folder.id, "downloading");
|
||||
|
||||
// Download messages/attachments
|
||||
@@ -1274,9 +1274,21 @@ class Core {
|
||||
}
|
||||
}
|
||||
|
||||
if (state.running) {
|
||||
if (state.running && folder.initialize != 0) {
|
||||
folder.initialize = 0;
|
||||
db.folder().setFolderInitialize(folder.id, 0);
|
||||
|
||||
// Schedule download
|
||||
if (download) {
|
||||
EntityOperation operation = new EntityOperation();
|
||||
operation.account = folder.account;
|
||||
operation.folder = folder.id;
|
||||
operation.message = null;
|
||||
operation.name = EntityOperation.SYNC;
|
||||
operation.args = jargs.toString();
|
||||
operation.created = new Date().getTime();
|
||||
operation.id = db.operation().insertOperation(operation);
|
||||
}
|
||||
}
|
||||
|
||||
db.folder().setFolderSync(folder.id, new Date().getTime());
|
||||
|
||||
@@ -191,7 +191,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
||||
}
|
||||
|
||||
JSONArray jargs = new JSONArray();
|
||||
jargs.put(initialize == 0 ? days : Math.max(keep_days, initialize));
|
||||
jargs.put(initialize == 0 ? days : Math.min(keep_days, initialize));
|
||||
jargs.put(keep_days);
|
||||
jargs.put(download);
|
||||
jargs.put(auto_delete);
|
||||
|
||||
Reference in New Issue
Block a user