mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-28 02:37:16 +00:00
Show invalid DNS names bold
This commit is contained in:
parent
c94f2ceaca
commit
1403f4f520
1 changed files with 7 additions and 2 deletions
|
@ -24,6 +24,7 @@ import static eu.faircode.email.ServiceAuthenticator.AUTH_TYPE_PASSWORD;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Typeface;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -485,7 +486,7 @@ public class FragmentQuickSetup extends FragmentBase {
|
||||||
tvImap.setText(result == null ? null : result.imap.toString());
|
tvImap.setText(result == null ? null : result.imap.toString());
|
||||||
tvSmtp.setText(result == null ? null : result.smtp.toString());
|
tvSmtp.setText(result == null ? null : result.smtp.toString());
|
||||||
grpSetup.setVisibility(result == null ? View.GONE : View.VISIBLE);
|
grpSetup.setVisibility(result == null ? View.GONE : View.VISIBLE);
|
||||||
showCertInfo(args);
|
showCertInfo(result, args);
|
||||||
btnSave.setVisibility(result == null ? View.GONE : View.VISIBLE);
|
btnSave.setVisibility(result == null ? View.GONE : View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
FragmentDialogAccount fragment = new FragmentDialogAccount();
|
FragmentDialogAccount fragment = new FragmentDialogAccount();
|
||||||
|
@ -555,7 +556,7 @@ public class FragmentQuickSetup extends FragmentBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showCertInfo(Bundle args) {
|
private void showCertInfo(EmailProvider provider, Bundle args) {
|
||||||
X509Certificate imap_certificate =
|
X509Certificate imap_certificate =
|
||||||
(X509Certificate) args.getSerializable("imap_certificate");
|
(X509Certificate) args.getSerializable("imap_certificate");
|
||||||
X509Certificate smtp_certificate =
|
X509Certificate smtp_certificate =
|
||||||
|
@ -567,6 +568,7 @@ public class FragmentQuickSetup extends FragmentBase {
|
||||||
imapNames = EntityCertificate.getDnsNames(imap_certificate);
|
imapNames = EntityCertificate.getDnsNames(imap_certificate);
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
|
boolean imapMatches = EntityCertificate.matches(provider.imap.host, imapNames);
|
||||||
|
|
||||||
List<String> smtpNames = new ArrayList<>();
|
List<String> smtpNames = new ArrayList<>();
|
||||||
if (smtp_certificate != null)
|
if (smtp_certificate != null)
|
||||||
|
@ -574,11 +576,14 @@ public class FragmentQuickSetup extends FragmentBase {
|
||||||
smtpNames = EntityCertificate.getDnsNames(smtp_certificate);
|
smtpNames = EntityCertificate.getDnsNames(smtp_certificate);
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
|
boolean smtpMatches = EntityCertificate.matches(provider.imap.host, smtpNames);
|
||||||
|
|
||||||
tvImapFingerprint.setText(EntityCertificate.getKeyFingerprint(imap_certificate));
|
tvImapFingerprint.setText(EntityCertificate.getKeyFingerprint(imap_certificate));
|
||||||
tvImapDnsNames.setText(TextUtils.join(", ", imapNames));
|
tvImapDnsNames.setText(TextUtils.join(", ", imapNames));
|
||||||
|
tvImapDnsNames.setTypeface(imapMatches ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
|
||||||
tvSmtpFingerprint.setText(EntityCertificate.getKeyFingerprint(smtp_certificate));
|
tvSmtpFingerprint.setText(EntityCertificate.getKeyFingerprint(smtp_certificate));
|
||||||
tvSmtpDnsNames.setText(TextUtils.join(", ", smtpNames));
|
tvSmtpDnsNames.setText(TextUtils.join(", ", smtpNames));
|
||||||
|
tvSmtpDnsNames.setTypeface(smtpMatches ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
|
||||||
|
|
||||||
grpCertificate.setVisibility(
|
grpCertificate.setVisibility(
|
||||||
imap_certificate == null && smtp_certificate == null
|
imap_certificate == null && smtp_certificate == null
|
||||||
|
|
Loading…
Reference in a new issue