Loading legacy/core/src/main/java/com/fsck/k9/controller/MessagingController.java +8 −0 Original line number Diff line number Diff line Loading @@ -697,9 +697,17 @@ public class MessagingController implements MessagingControllerRegistry, Messagi for (android.accounts.Account deviceAccount : eeloAccounts) { String hostUrl = accountManager.getUserData(deviceAccount, AccountManagerConstants.KEY_OC_BASE_URL); String authState = accountManager.getUserData(deviceAccount, AccountManagerConstants.KEY_AUTH_STATE); boolean isOpenId = authState != null && !authState.trim().isEmpty(); if (isOpenId) { continue; } if (hostUrl == null || !AccountManagerHelper.INSTANCE.isMurenaWebHostUrl(hostUrl)) { continue; } // Check if the account email matches with account manager String emailId = accountManager.getUserData(deviceAccount, AccountManagerConstants.ACCOUNT_EMAIL_ADDRESS_KEY); Loading legacy/ui/legacy/src/main/java/com/fsck/k9/activity/accountmanager/EeloAccountCreator.kt +16 −9 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ServerSettings import com.fsck.k9.mailstore.LocalStoreProvider import com.fsck.k9.mailstore.SpecialLocalFoldersCreator import java.util.stream.Collectors import org.koin.core.component.KoinComponent import org.koin.core.component.inject Loading Loading @@ -121,19 +122,23 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { val accountManager = AccountManager.get(mContext) val accounts = preferences.getAccounts() deleteIncompleteAccounts(accounts, accountManager) // deleteIncompleteAccounts is asynchronous. // The second time we call preferences.getAccounts() // The accounts might not yet be removed val finalAccounts = accounts.stream() .filter(kAccount::isFinishedSetup) .collect(Collectors.toList()) AccountManagerConstants.ACCOUNT_TYPES .forEach { accountType -> loadAccounts( accountType, accounts, finalAccounts, accountManager, ) } // Return true if new accounts uuid were added return preferences.getAccounts() .any { it -> it.uuid !in accounts.map { it.uuid } } return true } catch (e: SecurityException) { Timber.d( "Failed to load accounts from accountManager because of security violation") Timber.d( "Failed to load accounts from accountManager because of security violation: $e") } return false } Loading @@ -146,6 +151,9 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { val accountList = accountManager.getAccountsByType(accountType) for (account in accountList) { var emailId = accountManager.getUserData(account, AccountManagerConstants.ACCOUNT_EMAIL_ADDRESS_KEY) val authState = accountManager.getUserData(account, AccountManagerConstants.KEY_AUTH_STATE) val isOpenId = authState != null && authState.trim { it <= ' ' }.isNotEmpty() // Temp fix for yahoo login if (emailId == "null" || emailId.isNullOrEmpty()) { emailId = account.name Loading @@ -168,14 +176,13 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { .filter { acc: kAccount -> emailId.equals(acc.email, ignoreCase = true) } .peek { acc: kAccount? -> updateAccountNameIfMissing(emailId, acc!!) if (!isOpenId) { updatePasswordIfChanged(acc, password) } } .findAny() if (!existenceAccount.isPresent) { val authState = accountManager.getUserData(account, AccountManagerConstants.KEY_AUTH_STATE) val isOpenId = authState != null && authState.trim { it <= ' ' }.isNotEmpty() if (isOpenId) { createAccount(emailId, "", authState, accountType) } else if (!password.isNullOrEmpty()) { Loading Loading
legacy/core/src/main/java/com/fsck/k9/controller/MessagingController.java +8 −0 Original line number Diff line number Diff line Loading @@ -697,9 +697,17 @@ public class MessagingController implements MessagingControllerRegistry, Messagi for (android.accounts.Account deviceAccount : eeloAccounts) { String hostUrl = accountManager.getUserData(deviceAccount, AccountManagerConstants.KEY_OC_BASE_URL); String authState = accountManager.getUserData(deviceAccount, AccountManagerConstants.KEY_AUTH_STATE); boolean isOpenId = authState != null && !authState.trim().isEmpty(); if (isOpenId) { continue; } if (hostUrl == null || !AccountManagerHelper.INSTANCE.isMurenaWebHostUrl(hostUrl)) { continue; } // Check if the account email matches with account manager String emailId = accountManager.getUserData(deviceAccount, AccountManagerConstants.ACCOUNT_EMAIL_ADDRESS_KEY); Loading
legacy/ui/legacy/src/main/java/com/fsck/k9/activity/accountmanager/EeloAccountCreator.kt +16 −9 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ServerSettings import com.fsck.k9.mailstore.LocalStoreProvider import com.fsck.k9.mailstore.SpecialLocalFoldersCreator import java.util.stream.Collectors import org.koin.core.component.KoinComponent import org.koin.core.component.inject Loading Loading @@ -121,19 +122,23 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { val accountManager = AccountManager.get(mContext) val accounts = preferences.getAccounts() deleteIncompleteAccounts(accounts, accountManager) // deleteIncompleteAccounts is asynchronous. // The second time we call preferences.getAccounts() // The accounts might not yet be removed val finalAccounts = accounts.stream() .filter(kAccount::isFinishedSetup) .collect(Collectors.toList()) AccountManagerConstants.ACCOUNT_TYPES .forEach { accountType -> loadAccounts( accountType, accounts, finalAccounts, accountManager, ) } // Return true if new accounts uuid were added return preferences.getAccounts() .any { it -> it.uuid !in accounts.map { it.uuid } } return true } catch (e: SecurityException) { Timber.d( "Failed to load accounts from accountManager because of security violation") Timber.d( "Failed to load accounts from accountManager because of security violation: $e") } return false } Loading @@ -146,6 +151,9 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { val accountList = accountManager.getAccountsByType(accountType) for (account in accountList) { var emailId = accountManager.getUserData(account, AccountManagerConstants.ACCOUNT_EMAIL_ADDRESS_KEY) val authState = accountManager.getUserData(account, AccountManagerConstants.KEY_AUTH_STATE) val isOpenId = authState != null && authState.trim { it <= ' ' }.isNotEmpty() // Temp fix for yahoo login if (emailId == "null" || emailId.isNullOrEmpty()) { emailId = account.name Loading @@ -168,14 +176,13 @@ internal class EeloAccountCreator(context: Context) : KoinComponent { .filter { acc: kAccount -> emailId.equals(acc.email, ignoreCase = true) } .peek { acc: kAccount? -> updateAccountNameIfMissing(emailId, acc!!) if (!isOpenId) { updatePasswordIfChanged(acc, password) } } .findAny() if (!existenceAccount.isPresent) { val authState = accountManager.getUserData(account, AccountManagerConstants.KEY_AUTH_STATE) val isOpenId = authState != null && authState.trim { it <= ' ' }.isNotEmpty() if (isOpenId) { createAccount(emailId, "", authState, accountType) } else if (!password.isNullOrEmpty()) { Loading