1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Reselect Gmail archive folder if needed

This commit is contained in:
M66B 2021-08-21 10:51:19 +02:00
parent ed0ea8f526
commit cb2bb0f5d7

View file

@ -2061,6 +2061,23 @@ class Core {
folder.name = fullName;
db.folder().setFolderName(folder.id, fullName);
}
// Reselect Gmail archive folder
if (EntityFolder.ARCHIVE.equals(type) && account.isGmail()) {
boolean gmail_archive_fixed = prefs.getBoolean("gmail_archive_fixed", false);
if (!gmail_archive_fixed) {
prefs.edit().putBoolean("gmail_archive_fixed", true).apply();
EntityFolder archive = db.folder().getFolderByType(account.id, EntityFolder.ARCHIVE);
if (archive == null) {
archive = db.folder().getFolderByName(account.id, fullName);
if (archive != null) {
Log.e("Reselecting Gmail archive=" + fullName);
archive.type = EntityFolder.ARCHIVE;
db.folder().setFolderType(archive.id, archive.type);
}
}
}
}
}
}