Loading legacy/ui/legacy/src/main/java/com/fsck/k9/activity/accountmanager/EeloAccountCreator.kt +12 −3 Original line number Diff line number Diff line Loading @@ -100,18 +100,27 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { return true } private fun deleteIncompleteAccounts() { val accounts = preferences.getAccounts() private fun deleteIncompleteAccounts(accounts: List<Account>, accountManager: AccountManager) { accounts.filter { !it.isFinishedSetup }.forEach { accountRemover.removeAccountAsync(it.uuid) } // Fetch all accounts from the system's AccountManager AccountManagerConstants.ACCOUNT_TYPES.forEach { accountType -> val systemAccounts = accountManager.getAccountsByType(accountType).map { it.name } // Remove accounts from preferences if their name is not in system accounts accounts.filter { account -> account.name !in systemAccounts }.forEach { accountRemover.removeAccountAsync(it.uuid) } } } fun loadAccountsFromAccountManager(): Boolean { try { val accountManager = AccountManager.get(mContext) val accounts = preferences.getAccounts() deleteIncompleteAccounts() deleteIncompleteAccounts(accounts, accountManager) AccountManagerConstants.ACCOUNT_TYPES .forEach { accountType -> loadAccounts( Loading Loading
legacy/ui/legacy/src/main/java/com/fsck/k9/activity/accountmanager/EeloAccountCreator.kt +12 −3 Original line number Diff line number Diff line Loading @@ -100,18 +100,27 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { return true } private fun deleteIncompleteAccounts() { val accounts = preferences.getAccounts() private fun deleteIncompleteAccounts(accounts: List<Account>, accountManager: AccountManager) { accounts.filter { !it.isFinishedSetup }.forEach { accountRemover.removeAccountAsync(it.uuid) } // Fetch all accounts from the system's AccountManager AccountManagerConstants.ACCOUNT_TYPES.forEach { accountType -> val systemAccounts = accountManager.getAccountsByType(accountType).map { it.name } // Remove accounts from preferences if their name is not in system accounts accounts.filter { account -> account.name !in systemAccounts }.forEach { accountRemover.removeAccountAsync(it.uuid) } } } fun loadAccountsFromAccountManager(): Boolean { try { val accountManager = AccountManager.get(mContext) val accounts = preferences.getAccounts() deleteIncompleteAccounts() deleteIncompleteAccounts(accounts, accountManager) AccountManagerConstants.ACCOUNT_TYPES .forEach { accountType -> loadAccounts( Loading