mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Tidy responsibilities
This commit is contained in:
parent
238c1650c5
commit
476cb1d4ce
@ -13,6 +13,7 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.fsck.k9.mail.store.RemoteStore;
|
||||||
import com.fsck.k9.mailstore.LocalStore;
|
import com.fsck.k9.mailstore.LocalStore;
|
||||||
import com.fsck.k9.preferences.Editor;
|
import com.fsck.k9.preferences.Editor;
|
||||||
import com.fsck.k9.preferences.Storage;
|
import com.fsck.k9.preferences.Storage;
|
||||||
@ -121,6 +122,11 @@ public class Preferences {
|
|||||||
accountsInOrder.remove(account);
|
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);
|
LocalStore.removeAccount(account);
|
||||||
|
|
||||||
account.deleteCertificates();
|
account.deleteCertificates();
|
||||||
|
@ -62,12 +62,10 @@ public abstract class RemoteStore extends Store {
|
|||||||
*/
|
*/
|
||||||
public static void removeInstance(StoreConfig storeConfig) {
|
public static void removeInstance(StoreConfig storeConfig) {
|
||||||
String uri = storeConfig.getStoreUri();
|
String uri = storeConfig.getStoreUri();
|
||||||
|
|
||||||
if (uri.startsWith("local")) {
|
if (uri.startsWith("local")) {
|
||||||
throw new RuntimeException("Asked to get non-local Store object but given " +
|
throw new RuntimeException("Asked to get non-local Store object but given " +
|
||||||
"LocalStore URI");
|
"LocalStore URI");
|
||||||
}
|
}
|
||||||
|
|
||||||
sStores.remove(uri);
|
sStores.remove(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import com.fsck.k9.mail.Folder;
|
|||||||
import com.fsck.k9.mail.MessageRetrievalListener;
|
import com.fsck.k9.mail.MessageRetrievalListener;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
import com.fsck.k9.mail.Store;
|
import com.fsck.k9.mail.Store;
|
||||||
import com.fsck.k9.mail.store.RemoteStore;
|
|
||||||
import com.fsck.k9.mailstore.StorageManager.StorageProvider;
|
import com.fsck.k9.mailstore.StorageManager.StorageProvider;
|
||||||
import com.fsck.k9.mail.store.StoreConfig;
|
import com.fsck.k9.mail.store.StoreConfig;
|
||||||
import com.fsck.k9.mailstore.LockableDatabase.DbCallback;
|
import com.fsck.k9.mailstore.LockableDatabase.DbCallback;
|
||||||
@ -207,12 +206,6 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeAccount(Account account) {
|
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 {
|
try {
|
||||||
removeInstance(account);
|
removeInstance(account);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user