Small improvement

This commit is contained in:
M66B 2020-10-22 13:02:02 +02:00
parent 2168d4d7de
commit 95319146d5
2 changed files with 12 additions and 8 deletions

View File

@ -206,7 +206,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
static final int DEFAULT_KEEP = 30; // days static final int DEFAULT_KEEP = 30; // days
static final int DEFAULT_KEEP_DRAFTS = 180; // days static final int DEFAULT_KEEP_DRAFTS = 180; // days
private static final List<String> SYSTEM_FOLDER_SYNC = Collections.unmodifiableList(Arrays.asList( static final List<String> SYSTEM_FOLDER_SYNC = Collections.unmodifiableList(Arrays.asList(
INBOX, INBOX,
DRAFTS, DRAFTS,
SENT, SENT,
@ -214,7 +214,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
TRASH, TRASH,
JUNK JUNK
)); ));
private static final List<Boolean> SYSTEM_FOLDER_POLL = Collections.unmodifiableList(Arrays.asList( static final List<Boolean> SYSTEM_FOLDER_POLL = Collections.unmodifiableList(Arrays.asList(
false, // inbox false, // inbox
false, // drafts false, // drafts
false, // sent false, // sent
@ -222,7 +222,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
true, // trash true, // trash
true // junk true // junk
)); // MUST match SYSTEM_FOLDER_SYNC )); // MUST match SYSTEM_FOLDER_SYNC
private static final List<Boolean> SYSTEM_FOLDER_DOWNLOAD = Collections.unmodifiableList(Arrays.asList( static final List<Boolean> SYSTEM_FOLDER_DOWNLOAD = Collections.unmodifiableList(Arrays.asList(
true, // inbox true, // inbox
true, // drafts true, // drafts
false, // sent false, // sent

View File

@ -1588,12 +1588,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
Throwable e = ex; Throwable e = ex;
while (e != null) { while (e != null) {
if (ConnectionHelper.isMaxConnections(e.getMessage())) { if (ConnectionHelper.isMaxConnections(e.getMessage())) {
for (String ft : new String[]{EntityFolder.TRASH, EntityFolder.JUNK}) { 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); EntityFolder f = db.folder().getFolderByType(account.id, ft);
if (f != null) if (f != null && f.synchronize) {
EntityLog.log(ServiceSynchronize.this, account.name + "/" + f.name + "=poll");
db.folder().setFolderPoll(f.id, true); db.folder().setFolderPoll(f.id, true);
} }
} }
}
e = e.getCause(); e = e.getCause();
} }
} }