From 95319146d58f96dd63972d449e2194e0c269af3f Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 22 Oct 2020 13:02:02 +0200 Subject: [PATCH] Small improvement --- .../main/java/eu/faircode/email/EntityFolder.java | 6 +++--- .../java/eu/faircode/email/ServiceSynchronize.java | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityFolder.java b/app/src/main/java/eu/faircode/email/EntityFolder.java index 22814a67d5..1a31b8148e 100644 --- a/app/src/main/java/eu/faircode/email/EntityFolder.java +++ b/app/src/main/java/eu/faircode/email/EntityFolder.java @@ -206,7 +206,7 @@ public class EntityFolder extends EntityOrder implements Serializable { static final int DEFAULT_KEEP = 30; // days static final int DEFAULT_KEEP_DRAFTS = 180; // days - private static final List SYSTEM_FOLDER_SYNC = Collections.unmodifiableList(Arrays.asList( + static final List SYSTEM_FOLDER_SYNC = Collections.unmodifiableList(Arrays.asList( INBOX, DRAFTS, SENT, @@ -214,7 +214,7 @@ public class EntityFolder extends EntityOrder implements Serializable { TRASH, JUNK )); - private static final List SYSTEM_FOLDER_POLL = Collections.unmodifiableList(Arrays.asList( + static final List SYSTEM_FOLDER_POLL = Collections.unmodifiableList(Arrays.asList( false, // inbox false, // drafts false, // sent @@ -222,7 +222,7 @@ public class EntityFolder extends EntityOrder implements Serializable { true, // trash true // junk )); // MUST match SYSTEM_FOLDER_SYNC - private static final List SYSTEM_FOLDER_DOWNLOAD = Collections.unmodifiableList(Arrays.asList( + static final List SYSTEM_FOLDER_DOWNLOAD = Collections.unmodifiableList(Arrays.asList( true, // inbox true, // drafts false, // sent diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index b651ce29fe..bfaf14da7c 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1588,11 +1588,15 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Throwable e = ex; while (e != null) { if (ConnectionHelper.isMaxConnections(e.getMessage())) { - for (String ft : new String[]{EntityFolder.TRASH, EntityFolder.JUNK}) { - EntityFolder f = db.folder().getFolderByType(account.id, ft); - if (f != null) - db.folder().setFolderPoll(f.id, true); - } + for (int i = 0; i < EntityFolder.SYSTEM_FOLDER_SYNC.size(); i++) + if (EntityFolder.SYSTEM_FOLDER_POLL.get(i)) { + String ft = EntityFolder.SYSTEM_FOLDER_SYNC.get(i); + EntityFolder f = db.folder().getFolderByType(account.id, ft); + if (f != null && f.synchronize) { + EntityLog.log(ServiceSynchronize.this, account.name + "/" + f.name + "=poll"); + db.folder().setFolderPoll(f.id, true); + } + } } e = e.getCause(); }