1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

review comments

This commit is contained in:
Art O Cathain 2015-02-23 17:28:42 +00:00
parent a656a61c65
commit d0fa82269f

View File

@ -392,6 +392,10 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
}
}
/**
* FIXME: Don't use an AsyncTask to perform network operations.
* See also discussion in https://github.com/k9mail/k-9/pull/560
*/
private class CheckAccountTask extends AsyncTask<CheckDirection, Integer, Void> {
private final Account account;
@ -410,28 +414,18 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
*/
if (cancelled()) {
return null;
} else {
final MessagingController ctrl = MessagingController.getInstance(getApplication());
ctrl.clearCertificateErrorNotifications(AccountSetupCheckSettings.this,
account, direction);
if (direction == CheckDirection.INCOMING) {
checkIncoming();
}
}
clearCertificateErrorNotifications(direction);
checkServerSettings(direction);
if (cancelled()) {
return null;
} else if (direction == CheckDirection.OUTGOING) {
checkOutgoing();
}
if (cancelled()) {
return null;
} else {
setResult(RESULT_OK);
finish();
}
setResult(RESULT_OK);
finish();
} catch (AuthenticationFailedException afe) {
Log.e(K9.LOG_TAG, "Error while testing settings", afe);
@ -449,6 +443,12 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
return null;
}
private void clearCertificateErrorNotifications(CheckDirection direction) {
final MessagingController ctrl = MessagingController.getInstance(getApplication());
ctrl.clearCertificateErrorNotifications(AccountSetupCheckSettings.this,
account, direction);
}
private boolean cancelled() {
if (mDestroyed) {
return true;
@ -460,6 +460,19 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
return false;
}
private void checkServerSettings(CheckDirection direction) throws MessagingException {
switch (direction) {
case INCOMING: {
checkIncoming();
break;
}
case OUTGOING: {
checkOutgoing();
break;
}
}
}
private void checkOutgoing() throws MessagingException {
if (!(account.getRemoteStore() instanceof WebDavStore)) {
publishProgress(R.string.account_setup_check_settings_check_outgoing_msg);