Loading app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +23 −3 Original line number Diff line number Diff line Loading @@ -681,6 +681,26 @@ public class MessagingController { notificationController.showAuthenticationErrorNotification(account, incoming); } public void handleAuthenticationFailure(Account account, boolean incoming, Exception exception) { if (account.shouldMigrateToOAuth()) { migrateAccountToOAuth(account); } if (shouldShowErrorNotification(account, exception)) { notificationController.showAuthenticationErrorNotification(account, incoming); } } // on network switch, sometime mail app failed to authenticate with auth2 accounts, but other operations works perfectly. // It is ignorable, because oauth2 authentication is handled via accountManager private boolean shouldShowErrorNotification(Account account, Exception exception) { if (account.getIncomingServerSettings().authenticationType != AuthType.XOAUTH2) { return true; } return !(exception instanceof AuthenticationFailedException); } private void migrateAccountToOAuth(Account account) { account.setIncomingServerSettings(account.getIncomingServerSettings().newAuthenticationType(AuthType.XOAUTH2)); account.setOutgoingServerSettings(account.getOutgoingServerSettings().newAuthenticationType(AuthType.XOAUTH2)); Loading @@ -691,7 +711,7 @@ public class MessagingController { public void handleException(Account account, Exception exception) { if (exception instanceof AuthenticationFailedException) { handleAuthenticationFailure(account, true); handleAuthenticationFailure(account, true, exception); } else { notifyUserIfCertificateProblem(account, exception, true); } Loading Loading @@ -1601,7 +1621,7 @@ public class MessagingController { lastFailure = e; wasPermanentFailure = false; handleAuthenticationFailure(account, false); handleAuthenticationFailure(account, false, e); handleSendFailure(account, localFolder, message, e); } catch (CertificateValidationException e) { outboxStateRepository.decrementSendAttempts(messageId); Loading Loading @@ -2781,7 +2801,7 @@ public class MessagingController { syncFailed = true; if (exception instanceof AuthenticationFailedException) { handleAuthenticationFailure(account, true); handleAuthenticationFailure(account, true, exception); } else { notifyUserIfCertificateProblem(account, exception, true); } Loading Loading
app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +23 −3 Original line number Diff line number Diff line Loading @@ -681,6 +681,26 @@ public class MessagingController { notificationController.showAuthenticationErrorNotification(account, incoming); } public void handleAuthenticationFailure(Account account, boolean incoming, Exception exception) { if (account.shouldMigrateToOAuth()) { migrateAccountToOAuth(account); } if (shouldShowErrorNotification(account, exception)) { notificationController.showAuthenticationErrorNotification(account, incoming); } } // on network switch, sometime mail app failed to authenticate with auth2 accounts, but other operations works perfectly. // It is ignorable, because oauth2 authentication is handled via accountManager private boolean shouldShowErrorNotification(Account account, Exception exception) { if (account.getIncomingServerSettings().authenticationType != AuthType.XOAUTH2) { return true; } return !(exception instanceof AuthenticationFailedException); } private void migrateAccountToOAuth(Account account) { account.setIncomingServerSettings(account.getIncomingServerSettings().newAuthenticationType(AuthType.XOAUTH2)); account.setOutgoingServerSettings(account.getOutgoingServerSettings().newAuthenticationType(AuthType.XOAUTH2)); Loading @@ -691,7 +711,7 @@ public class MessagingController { public void handleException(Account account, Exception exception) { if (exception instanceof AuthenticationFailedException) { handleAuthenticationFailure(account, true); handleAuthenticationFailure(account, true, exception); } else { notifyUserIfCertificateProblem(account, exception, true); } Loading Loading @@ -1601,7 +1621,7 @@ public class MessagingController { lastFailure = e; wasPermanentFailure = false; handleAuthenticationFailure(account, false); handleAuthenticationFailure(account, false, e); handleSendFailure(account, localFolder, message, e); } catch (CertificateValidationException e) { outboxStateRepository.decrementSendAttempts(messageId); Loading Loading @@ -2781,7 +2801,7 @@ public class MessagingController { syncFailed = true; if (exception instanceof AuthenticationFailedException) { handleAuthenticationFailure(account, true); handleAuthenticationFailure(account, true, exception); } else { notifyUserIfCertificateProblem(account, exception, true); } Loading