From c55c35a021251090245e8506d2f76a38fbf8b1bf Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 4 Jun 2020 08:52:25 +0200 Subject: [PATCH] Auto check STARTTLS on insecure connections --- .../main/java/eu/faircode/email/FragmentAccount.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 80cd26a99f..0c359a22b2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -330,6 +330,17 @@ public class FragmentAccount extends FragmentBase { } }); + cbInsecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Object tag = cbInsecure.getTag(); + if (tag != null && tag.equals(isChecked)) + return; + if (isChecked) + rgEncryption.check(R.id.radio_starttls); + } + }); + tilPassword.getEditText().addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -1408,6 +1419,7 @@ public class FragmentAccount extends FragmentBase { } rgEncryption.check(account != null && account.starttls ? R.id.radio_starttls : R.id.radio_ssl); + cbInsecure.setTag(account == null ? false : account.insecure); cbInsecure.setChecked(account == null ? false : account.insecure); etUser.setText(account == null ? null : account.user);