From 3f37946785ddd0be5982b9a92fc6ba9af41b0cd3 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 24 Jan 2020 00:27:17 +0100 Subject: [PATCH] synchronize hints to oauth2 things, remove hardcoded providers --- .../securesms/RegistrationActivity.java | 55 ++----------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/src/org/thoughtcrime/securesms/RegistrationActivity.java b/src/org/thoughtcrime/securesms/RegistrationActivity.java index a3dafcf35..037064a1d 100644 --- a/src/org/thoughtcrime/securesms/RegistrationActivity.java +++ b/src/org/thoughtcrime/securesms/RegistrationActivity.java @@ -242,7 +242,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve switch (type) { case EMAIL: verifyEmail(inputEditText); - updateProviderInfo(); checkOauth2start(); break; case SERVER: @@ -273,9 +272,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve .setTitle(R.string.login_info_oauth2_title) .setMessage(R.string.login_info_oauth2_text) .setNegativeButton(R.string.cancel, (dialog, which)->{ - if(isGmail(email)) { - showGmailNoOauth2Hint(); - } + updateProviderInfo(); oauth2started.set(false); }) .setPositiveButton(R.string.perm_continue, (dialog, which)-> { @@ -286,18 +283,13 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve }) .setCancelable(false) .show(); - } else if (isGmail(email)) { - showGmailNoOauth2Hint(); - oauth2started.set(false); - } else if (isOutlook(email)) { - showOutlookHint(); - oauth2started.set(false); - } - else { + } else { + updateProviderInfo(); oauth2started.set(false); } } else { + updateProviderInfo(); oauth2started.set(false); } @@ -374,45 +366,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve return !TextUtils.isEmpty(email) && Patterns.EMAIL_ADDRESS.matcher(email).matches(); } - private boolean isGmail(String email) { - return email != null && (email.toLowerCase().contains("@gmail.") || email.toLowerCase().contains("@googlemail.")); - } - - private void showGmailNoOauth2Hint() - { - if(!gmailDialogShown) { - gmailDialogShown = true; - new AlertDialog.Builder(this) - .setMessage(R.string.login_info_gmail_text) - .setPositiveButton(R.string.ok, null) - .show(); - } - } - - private boolean isOutlook(String email) { - return email != null - && (email.toLowerCase().contains("@outlook.") || email.toLowerCase().contains("@hotmail.")); - } - - private boolean outlookDialogShown; - private void showOutlookHint() - { - if(!outlookDialogShown) { - outlookDialogShown = true; - new AlertDialog.Builder(this) - .setMessage( - "Outlook- and Hotmail-e-mail-addresses " - + "may currently not work as expected " - + "as these servers may remove some important transport information." - + "\n\n" - + "Hopefully sooner or later there will be a fix; " - + "for now, we suggest to use another e-mail-address " - + "or try Delta Chat again when the issue is fixed.") - .setPositiveButton(R.string.ok, null) - .show(); - } - } - private void verifyEmail(TextInputEditText view) { String error = getString(R.string.login_error_mail); String email = view.getText().toString();