mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
review comments
This commit is contained in:
parent
a656a61c65
commit
d0fa82269f
@ -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 class CheckAccountTask extends AsyncTask<CheckDirection, Integer, Void> {
|
||||||
private final Account account;
|
private final Account account;
|
||||||
|
|
||||||
@ -410,28 +414,18 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
*/
|
*/
|
||||||
if (cancelled()) {
|
if (cancelled()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
}
|
||||||
final MessagingController ctrl = MessagingController.getInstance(getApplication());
|
|
||||||
ctrl.clearCertificateErrorNotifications(AccountSetupCheckSettings.this,
|
|
||||||
account, direction);
|
|
||||||
|
|
||||||
if (direction == CheckDirection.INCOMING) {
|
clearCertificateErrorNotifications(direction);
|
||||||
checkIncoming();
|
|
||||||
}
|
checkServerSettings(direction);
|
||||||
}
|
|
||||||
|
|
||||||
if (cancelled()) {
|
if (cancelled()) {
|
||||||
return null;
|
return null;
|
||||||
} else if (direction == CheckDirection.OUTGOING) {
|
|
||||||
checkOutgoing();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cancelled()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
setResult(RESULT_OK);
|
setResult(RESULT_OK);
|
||||||
finish();
|
finish();
|
||||||
}
|
|
||||||
|
|
||||||
} catch (AuthenticationFailedException afe) {
|
} catch (AuthenticationFailedException afe) {
|
||||||
Log.e(K9.LOG_TAG, "Error while testing settings", afe);
|
Log.e(K9.LOG_TAG, "Error while testing settings", afe);
|
||||||
@ -449,6 +443,12 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clearCertificateErrorNotifications(CheckDirection direction) {
|
||||||
|
final MessagingController ctrl = MessagingController.getInstance(getApplication());
|
||||||
|
ctrl.clearCertificateErrorNotifications(AccountSetupCheckSettings.this,
|
||||||
|
account, direction);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean cancelled() {
|
private boolean cancelled() {
|
||||||
if (mDestroyed) {
|
if (mDestroyed) {
|
||||||
return true;
|
return true;
|
||||||
@ -460,6 +460,19 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkServerSettings(CheckDirection direction) throws MessagingException {
|
||||||
|
switch (direction) {
|
||||||
|
case INCOMING: {
|
||||||
|
checkIncoming();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OUTGOING: {
|
||||||
|
checkOutgoing();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void checkOutgoing() throws MessagingException {
|
private void checkOutgoing() throws MessagingException {
|
||||||
if (!(account.getRemoteStore() instanceof WebDavStore)) {
|
if (!(account.getRemoteStore() instanceof WebDavStore)) {
|
||||||
publishProgress(R.string.account_setup_check_settings_check_outgoing_msg);
|
publishProgress(R.string.account_setup_check_settings_check_outgoing_msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user