diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java
index 8e6f806461..6e1815af8b 100644
--- a/app/src/main/java/eu/faircode/email/Core.java
+++ b/app/src/main/java/eu/faircode/email/Core.java
@@ -2253,9 +2253,11 @@ class Core {
boolean sync_folders = prefs.getBoolean("sync_folders", true);
boolean sync_folders_poll = prefs.getBoolean("sync_folders_poll", false);
boolean sync_shared_folders = prefs.getBoolean("sync_shared_folders", false);
+ boolean sync_added_folders = prefs.getBoolean("sync_added_folders", false);
Log.i(account.name + " sync folders=" + sync_folders +
" poll=" + sync_folders_poll +
" shared=" + sync_shared_folders +
+ " added=" + sync_added_folders +
" keep_alive=" + keep_alive +
" force=" + force);
@@ -2268,9 +2270,12 @@ class Core {
// Get folder names
boolean drafts = false;
+ boolean user = false;
Map local = new HashMap<>();
List folders = db.folder().getFolders(account.id, false, false);
for (EntityFolder folder : folders) {
+ if (EntityFolder.USER.equals(folder.type))
+ user = true;
if (folder.tbc != null) {
try {
// Prefix folder with namespace
@@ -2675,6 +2680,8 @@ class Core {
if (selectable)
folder.inheritFrom(parent);
+ if (user && sync_added_folders && EntityFolder.USER.equals(type))
+ folder.synchronize = true;
folder.id = db.folder().insertFolder(folder);
Log.i(folder.name + " added type=" + folder.type + " sync=" + folder.synchronize);
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java
index e98871e4dc..9c7ec46861 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java
@@ -94,6 +94,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
private SwitchCompat swSyncFolders;
private SwitchCompat swSyncFoldersPoll;
private SwitchCompat swSyncSharedFolders;
+ private SwitchCompat swSyncAdded;
private SwitchCompat swSubscriptions;
private SwitchCompat swTuneKeepAlive;
@@ -118,7 +119,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
"sync_quick_imap", "sync_quick_pop",
"sync_nodate", "sync_unseen", "sync_flagged", "delete_unseen", "sync_kept",
"gmail_thread_id", "outlook_thread_id", "subject_threading",
- "sync_folders", "sync_folders_poll", "sync_shared_folders", "subscriptions",
+ "sync_folders", "sync_folders_poll", "sync_shared_folders", "sync_added_folders", "subscriptions",
"check_authentication", "check_tls", "check_reply_domain", "check_mx",
"check_blocklist", "use_blocklist", "use_blocklist_pop",
"tune_keep_alive"
@@ -173,6 +174,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swSyncFolders = view.findViewById(R.id.swSyncFolders);
swSyncFoldersPoll = view.findViewById(R.id.swSyncFoldersPoll);
swSyncSharedFolders = view.findViewById(R.id.swSyncSharedFolders);
+ swSyncAdded = view.findViewById(R.id.swSyncAdded);
swSubscriptions = view.findViewById(R.id.swSubscriptions);
swTuneKeepAlive = view.findViewById(R.id.swTuneKeepAlive);
@@ -419,6 +421,13 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
}
});
+ swSyncAdded.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("sync_added_folders", checked).apply();
+ }
+ });
+
swSubscriptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -603,6 +612,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swSyncFoldersPoll.setEnabled(swSyncFolders.isChecked());
swSyncSharedFolders.setChecked(prefs.getBoolean("sync_shared_folders", false));
swSyncSharedFolders.setEnabled(swSyncFolders.isChecked());
+ swSyncAdded.setChecked(prefs.getBoolean("sync_added_folders", false));
swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false));
swTuneKeepAlive.setChecked(prefs.getBoolean("tune_keep_alive", true));
swCheckAuthentication.setChecked(prefs.getBoolean("check_authentication", true));
diff --git a/app/src/main/res/layout/fragment_options_synchronize.xml b/app/src/main/res/layout/fragment_options_synchronize.xml
index 8920855a16..d25708b2f1 100644
--- a/app/src/main/res/layout/fragment_options_synchronize.xml
+++ b/app/src/main/res/layout/fragment_options_synchronize.xml
@@ -757,6 +757,17 @@
app:layout_constraintTop_toBottomOf="@id/tvSyncFoldersPoll"
app:switchPadding="12dp" />
+
+
Synchronize folder list
Actively synchronize folder list
Synchronize shared folder lists
+ Enable synchronization for new user folders
Manage folder subscriptions
Check message authentication
Check transport layer security (TLS)