Refactoring

This commit is contained in:
M66B 2022-11-10 16:00:20 +01:00
parent 76cf2d5723
commit 0571cc07a1
3 changed files with 8 additions and 6 deletions

View File

@ -177,6 +177,10 @@ public class EntityAccount extends EntityOrder implements Serializable {
return "outlook.office365.com".equalsIgnoreCase(host);
}
static boolean isOutlook(String id) {
return ("office365".equals(id) || "outlook".equals(id));
}
boolean isYahooJp() {
return "imap.mail.yahoo.co.jp".equalsIgnoreCase(host);
}

View File

@ -319,9 +319,8 @@ public class FragmentAccount extends FragmentBase {
etUser.setTag(null);
etUser.setText(null);
tilPassword.getEditText().setText(null);
tvAppPassword.setVisibility(
"office365".equals(provider.id) || "outlook".equals(provider.id)
? View.VISIBLE : View.GONE);
tvAppPassword.setVisibility(EntityAccount.isOutlook(provider.id)
? View.VISIBLE : View.GONE);
certificate = null;
tvCertificate.setText(R.string.title_optional);
etRealm.setText(null);
@ -1606,8 +1605,7 @@ public class FragmentAccount extends FragmentBase {
etUser.setText(account == null ? null : account.user);
tilPassword.getEditText().setText(account == null ? null : account.password);
tvAppPassword.setVisibility(account != null &&
("office365".equals(account.provider) || "outlook".equals(account.provider))
tvAppPassword.setVisibility(account != null && EntityAccount.isOutlook(account.provider)
? View.VISIBLE : View.GONE);
certificate = (account == null ? null : account.certificate_alias);
tvCertificate.setText(certificate == null ? getString(R.string.title_optional) : certificate);

View File

@ -1006,7 +1006,7 @@ public class FragmentOAuth extends FragmentBase {
grpError.setVisibility(View.VISIBLE);
if ("office365".equals(id) || "outlook".equals(id)) {
if (EntityAccount.isOutlook(id)) {
if (ex instanceof AuthenticationFailedException)
tvOfficeAuthHint.setVisibility(View.VISIBLE);
}