From 26079e9c09b460520ba317838bee430f5eaca29b Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 20 Oct 2020 20:40:01 +0200 Subject: [PATCH] OAuth is approved for official builds only --- FAQ.md | 4 +++- .../java/eu/faircode/email/FragmentSetup.java | 22 ++++++++++--------- app/src/main/res/values/strings.xml | 1 + 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/FAQ.md b/FAQ.md index 71eb2e27f0..244970e99b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -3137,7 +3137,9 @@ Therefore you are advised to switch to the GitHub release. The F-Droid version is built from the same source code, but signed differently. This means that all features are available in the F-Droid version too, -except for using the Gmail quick setup wizard because Google approved (and allows) one signature only. +except for using the Gmail quick setup wizard because Google approved (and allows) one app signature only. +For all other email providers, OAuth access is only available in Play Store versions and Github releases, +as the email providers only permit the use of OAuth for official builds. Note that you'll need to uninstall the F-Droid build first before you can install a GitHub release because Android refuses to install the same app with a different signature for security reasons. diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index d6441ab6b2..ba16ccf94d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -171,15 +171,14 @@ public class FragmentSetup extends FragmentBase { popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_gmail, order++, R.string.title_setup_gmail); popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_outlook, order++, R.string.title_setup_outlook); - if (Helper.hasValidFingerprint(getContext()) || BuildConfig.DEBUG) - for (EmailProvider provider : EmailProvider.loadProfiles(getContext())) - if (provider.oauth != null && provider.oauth.enabled) - popupMenu.getMenu() - .add(Menu.NONE, -1, order++, getString(R.string.title_setup_oauth, provider.name)) - .setIntent(new Intent(ActivitySetup.ACTION_QUICK_OAUTH) - .putExtra("id", provider.id) - .putExtra("name", provider.name) - .putExtra("askAccount", provider.oauth.askAccount)); + for (EmailProvider provider : EmailProvider.loadProfiles(getContext())) + if (provider.oauth != null && provider.oauth.enabled) + popupMenu.getMenu() + .add(Menu.NONE, -1, order++, getString(R.string.title_setup_oauth, provider.name)) + .setIntent(new Intent(ActivitySetup.ACTION_QUICK_OAUTH) + .putExtra("id", provider.id) + .putExtra("name", provider.name) + .putExtra("askAccount", provider.oauth.askAccount)); //popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_activesync, order++, R.string.title_setup_activesync); popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_other, order++, R.string.title_setup_other); @@ -206,7 +205,10 @@ public class FragmentSetup extends FragmentBase { if (item.getIntent() == null) return false; else { - lbm.sendBroadcast(item.getIntent()); + if (Helper.hasValidFingerprint(getContext()) || BuildConfig.DEBUG) + lbm.sendBroadcast(item.getIntent()); + else + ToastEx.makeText(getContext(), R.string.title_setup_oauth_permission, Toast.LENGTH_LONG).show(); return true; } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 57824f8ddc..8137609bf9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -172,6 +172,7 @@ Gmail Outlook, Live, Hotmail %1$s (OAuth) + The email provider has approved OAuth only for official app versions Exchange ActiveSync Other provider Authorizing Google accounts will work in official versions only because Android checks the app signature