From bf9c2124e0b9aa62d2ccd85825de14b949cf23b3 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 21 Oct 2021 15:16:28 +0200 Subject: [PATCH] Added OAuth help --- FAQ.md | 4 ++- .../java/eu/faircode/email/FragmentOAuth.java | 25 +++++++++++++++++++ app/src/main/res/layout/fragment_oauth.xml | 15 +++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 1485e554fb..19082fe67c 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1001,11 +1001,13 @@ The easiest way is to use the menu item *Fetch more messages* in the three-dots An Outlook / Live / Hotmail account can be set up via the quick setup wizard and selecting *Outlook/Office 365*. -To use an Outlook, Live or Hotmail account with two factor authentication enabled, you need to create an app password. +To use an Outlook, Live or Hotmail account with two factor authentication enabled, you might need to create an app password. See [here](https://support.microsoft.com/en-us/help/12409/microsoft-account-app-passwords-two-step-verification) for the details. See [here](https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040) for Microsoft's instructions. +Please see [this FAQ](#user-content-faq139) for possible causes of the error *... User is authenticated but not connected ...*. + For setting up an Office 365 account, please see [this FAQ](#user-content-faq156).
diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 5081676320..d0f8b6a2bb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -118,6 +118,7 @@ public class FragmentOAuth extends FragmentBase { private TextView tvGmailDraftsHint; private TextView tvOfficeAuthHint; private Button btnSupport; + private Button btnHelp; private Group grpError; @@ -162,6 +163,7 @@ public class FragmentOAuth extends FragmentBase { tvGmailDraftsHint = view.findViewById(R.id.tvGmailDraftsHint); tvOfficeAuthHint = view.findViewById(R.id.tvOfficeAuthHint); btnSupport = view.findViewById(R.id.btnSupport); + btnHelp = view.findViewById(R.id.btnHelp); grpError = view.findViewById(R.id.grpError); @@ -190,6 +192,18 @@ public class FragmentOAuth extends FragmentBase { } }); + btnHelp.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + try { + EmailProvider provider = EmailProvider.getProvider(v.getContext(), id); + Helper.view(v.getContext(), Uri.parse(provider.link), false); + } catch (Throwable ex) { + Log.e(ex); + } + } + }); + // Initialize tvTitle.setText(getString(R.string.title_setup_oauth_rationale, name)); etName.setVisibility(askAccount ? View.VISIBLE : View.GONE); @@ -933,6 +947,16 @@ public class FragmentOAuth extends FragmentBase { tvOfficeAuthHint.setVisibility(View.VISIBLE); } + EmailProvider provider; + try { + provider = EmailProvider.getProvider(getContext(), id); + } catch (Throwable exex) { + Log.e(exex); + provider = null; + } + + btnHelp.setVisibility((provider != null && provider.link != null ? View.VISIBLE : View.GONE)); + etName.setEnabled(true); etEmail.setEnabled(true); cbUpdate.setEnabled(true); @@ -950,6 +974,7 @@ public class FragmentOAuth extends FragmentBase { } private void hideError() { + btnHelp.setVisibility(View.GONE); grpError.setVisibility(View.GONE); tvGmailDraftsHint.setVisibility(View.GONE); tvOfficeAuthHint.setVisibility(View.GONE); diff --git a/app/src/main/res/layout/fragment_oauth.xml b/app/src/main/res/layout/fragment_oauth.xml index 4c69bc08a6..a73142d34c 100644 --- a/app/src/main/res/layout/fragment_oauth.xml +++ b/app/src/main/res/layout/fragment_oauth.xml @@ -181,6 +181,21 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvOfficeAuthHint" /> +