From 476cb1d4ce6a2f1236b8b193362ac604e33bb13a Mon Sep 17 00:00:00 2001 From: Jan Berkel Date: Sun, 14 Dec 2014 15:58:08 +0000 Subject: [PATCH] Tidy responsibilities --- src/com/fsck/k9/Preferences.java | 6 ++++++ src/com/fsck/k9/mail/store/RemoteStore.java | 2 -- src/com/fsck/k9/mailstore/LocalStore.java | 7 ------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/com/fsck/k9/Preferences.java b/src/com/fsck/k9/Preferences.java index 016928eb0..03a3cd1be 100644 --- a/src/com/fsck/k9/Preferences.java +++ b/src/com/fsck/k9/Preferences.java @@ -13,6 +13,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.util.Log; +import com.fsck.k9.mail.store.RemoteStore; import com.fsck.k9.mailstore.LocalStore; import com.fsck.k9.preferences.Editor; import com.fsck.k9.preferences.Storage; @@ -121,6 +122,11 @@ public class Preferences { accountsInOrder.remove(account); } + try { + RemoteStore.removeInstance(account); + } catch (Exception e) { + Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + account.getUuid(), e); + } LocalStore.removeAccount(account); account.deleteCertificates(); diff --git a/src/com/fsck/k9/mail/store/RemoteStore.java b/src/com/fsck/k9/mail/store/RemoteStore.java index 9cad2aac2..a1f32722e 100644 --- a/src/com/fsck/k9/mail/store/RemoteStore.java +++ b/src/com/fsck/k9/mail/store/RemoteStore.java @@ -62,12 +62,10 @@ public abstract class RemoteStore extends Store { */ public static void removeInstance(StoreConfig storeConfig) { String uri = storeConfig.getStoreUri(); - if (uri.startsWith("local")) { throw new RuntimeException("Asked to get non-local Store object but given " + "LocalStore URI"); } - sStores.remove(uri); } diff --git a/src/com/fsck/k9/mailstore/LocalStore.java b/src/com/fsck/k9/mailstore/LocalStore.java index 45ce9ad42..b05a9efa2 100644 --- a/src/com/fsck/k9/mailstore/LocalStore.java +++ b/src/com/fsck/k9/mailstore/LocalStore.java @@ -21,7 +21,6 @@ import com.fsck.k9.mail.Folder; import com.fsck.k9.mail.MessageRetrievalListener; import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.Store; -import com.fsck.k9.mail.store.RemoteStore; import com.fsck.k9.mailstore.StorageManager.StorageProvider; import com.fsck.k9.mail.store.StoreConfig; import com.fsck.k9.mailstore.LockableDatabase.DbCallback; @@ -207,12 +206,6 @@ public class LocalStore extends Store implements Serializable { } public static void removeAccount(Account account) { - try { - RemoteStore.removeInstance(account); - } catch (Exception e) { - Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + account.getUuid(), e); - } - try { removeInstance(account); } catch (Exception e) {