From e24ce5ead60b02ac6ae22909b876878507f0aad5 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 5 Apr 2020 22:01:27 +0200 Subject: [PATCH] Sync folders on add account --- app/src/main/java/eu/faircode/email/FragmentGmail.java | 2 ++ app/src/main/java/eu/faircode/email/FragmentOAuth.java | 2 ++ app/src/main/java/eu/faircode/email/FragmentPop.java | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentGmail.java b/app/src/main/java/eu/faircode/email/FragmentGmail.java index 1555f23d9d..994bbb08c7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentGmail.java +++ b/app/src/main/java/eu/faircode/email/FragmentGmail.java @@ -368,6 +368,8 @@ public class FragmentGmail extends FragmentBase { folder.account = account.id; folder.id = db.folder().insertFolder(folder); EntityLog.log(context, "Gmail folder=" + folder.name + " type=" + folder.type); + if (folder.synchronize) + EntityOperation.sync(context, folder.id, false); } } diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 62e6218258..74322ae06c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -493,6 +493,8 @@ public class FragmentOAuth extends FragmentBase { folder.account = account.id; folder.id = db.folder().insertFolder(folder); EntityLog.log(context, "OAuth folder=" + folder.name + " type=" + folder.type); + if (folder.synchronize) + EntityOperation.sync(context, folder.id, false); } } diff --git a/app/src/main/java/eu/faircode/email/FragmentPop.java b/app/src/main/java/eu/faircode/email/FragmentPop.java index a1bc823afd..469868b7b5 100644 --- a/app/src/main/java/eu/faircode/email/FragmentPop.java +++ b/app/src/main/java/eu/faircode/email/FragmentPop.java @@ -422,6 +422,9 @@ public class FragmentPop extends FragmentBase { inbox.keep_days = Integer.MAX_VALUE; inbox.initialize = 0; inbox.id = db.folder().insertFolder(inbox); + + if (account.synchronize) + EntityOperation.sync(context, inbox.id, false); } EntityFolder drafts = db.folder().getFolderByType(account.id, EntityFolder.DRAFTS); @@ -474,7 +477,7 @@ public class FragmentPop extends FragmentBase { db.endTransaction(); } - ServiceSynchronize.eval(context, "save account"); + ServiceSynchronize.eval(context, "POP3"); if (!synchronize) { NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);