Clean up LocalFolder.delete()

This commit is contained in:
cketti 2019-01-10 00:08:26 +01:00
parent eeb820b958
commit 9d9d46868f
3 changed files with 6 additions and 9 deletions

View file

@ -49,10 +49,7 @@ class K9BackendStorage(
folderServerIds.asSequence()
.filterNot { account.isSpecialFolder(it) }
.map { localStore.getFolder(it) }
.forEach {
it.deleteSettings()
it.delete(true)
}
.forEach { it.delete() }
specialFolderUpdater.updateSpecialFolders()
}

View file

@ -29,7 +29,6 @@ import android.support.annotation.NonNull;
import com.fsck.k9.Account;
import com.fsck.k9.DI;
import com.fsck.k9.K9;
import com.fsck.k9.Preferences;
import com.fsck.k9.controller.MessageReference;
import com.fsck.k9.backend.api.MessageRemovalListener;
import com.fsck.k9.crypto.EncryptionExtractor;
@ -629,7 +628,7 @@ public class LocalFolder extends Folder<LocalMessage> {
return getPrefId(serverId);
}
public void deleteSettings() throws MessagingException {
private void deleteSettings() throws MessagingException {
String id = getPrefId();
StorageEditor editor = localStore.getPreferences().createStorageEditor();
@ -1899,7 +1898,7 @@ public class LocalFolder extends Folder<LocalMessage> {
setVisibleLimit(getAccount().getDisplayCount());
}
public void delete(final boolean recurse) throws MessagingException {
public void delete() throws MessagingException {
try {
this.localStore.getDatabase().execute(false, new DbCallback<Void>() {
@Override
@ -1922,6 +1921,8 @@ public class LocalFolder extends Folder<LocalMessage> {
} catch (WrappedException e) {
throw(MessagingException) e.getCause();
}
deleteSettings();
}
@Override

View file

@ -50,8 +50,7 @@ class MigrationTo43 {
}
// Now get rid of the localized outbox
obsoleteOutbox.deleteSettings();
obsoleteOutbox.delete(true);
obsoleteOutbox.delete();
}
} catch (Exception e) {
Timber.e(e, "Error trying to fix the outbox folders");