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_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,
DRAFTS,
SENT,
@ -214,7 +214,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
TRASH,
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, // 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<Boolean> SYSTEM_FOLDER_DOWNLOAD = Collections.unmodifiableList(Arrays.asList(
static final List<Boolean> SYSTEM_FOLDER_DOWNLOAD = Collections.unmodifiableList(Arrays.asList(
true, // inbox
true, // drafts
false, // sent

View File

@ -1588,12 +1588,16 @@ 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}) {
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)
if (f != null && f.synchronize) {
EntityLog.log(ServiceSynchronize.this, account.name + "/" + f.name + "=poll");
db.folder().setFolderPoll(f.id, true);
}
}
}
e = e.getCause();
}
}