From a33fa3142f5f03746cf20540515a1d9c50c6a9ea Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 27 Sep 2024 22:25:06 +0200 Subject: [PATCH] Added remark about Edge --- .../java/eu/faircode/email/FragmentOAuth.java | 19 ++++++++++++++----- app/src/main/res/layout/fragment_oauth.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 452ce717f2..f56d5fb1ee 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -123,6 +123,7 @@ public class FragmentOAuth extends FragmentBase { private CheckBox cbPop; private CheckBox cbRecent; private CheckBox cbUpdate; + private TextView tvEdge; private TextView tvBrave; private Button btnOAuth; private ContentLoadingProgressBar pbOAuth; @@ -185,6 +186,7 @@ public class FragmentOAuth extends FragmentBase { cbPop = view.findViewById(R.id.cbPop); cbRecent = view.findViewById(R.id.cbRecent); cbUpdate = view.findViewById(R.id.cbUpdate); + tvEdge = view.findViewById(R.id.tvEdge); tvBrave = view.findViewById(R.id.tvBrave); btnOAuth = view.findViewById(R.id.btnOAuth); pbOAuth = view.findViewById(R.id.pbOAuth); @@ -259,6 +261,7 @@ public class FragmentOAuth extends FragmentBase { } + boolean edge = false; boolean brave = false; try { PackageManager pm = getContext().getPackageManager(); @@ -268,16 +271,17 @@ public class FragmentOAuth extends FragmentBase { int flags = (Build.VERSION.SDK_INT < Build.VERSION_CODES.M ? 0 : PackageManager.MATCH_ALL); List browsers = pm.queryIntentActivities(intent, flags); for (ResolveInfo browser : browsers) - if (browser.activityInfo.packageName.startsWith("com.brave.browser")) { - // _beta _nightly + if (TextUtils.isEmpty(browser.activityInfo.packageName)) + continue; + else if (browser.activityInfo.packageName.startsWith("com.brave.browser")) // _beta _nightly brave = true; - break; - } + else if (browser.activityInfo.packageName.startsWith("com.microsoft.emmx")) // .beta .canary .dev + edge = true; } catch (Throwable ex) { Log.e(ex); - brave = true; } + tvEdge.setVisibility(edge ? View.VISIBLE : View.GONE); tvBrave.setVisibility(brave ? View.VISIBLE : View.GONE); btnOAuth.setOnClickListener(new View.OnClickListener() { @@ -511,6 +515,11 @@ public class FragmentOAuth extends FragmentBase { @Override public boolean matches(@NonNull BrowserDescriptor descriptor) { + if (BuildConfig.DEBUG) { + boolean edge = "com.microsoft.emmx".equals(descriptor.packageName); + Log.i("MMM " + descriptor.packageName + "=" + edge); + return edge; + } boolean accept = !(SBROWSER.matches(descriptor) || SBROWSER_TAB.matches(descriptor)); if (descriptor.useCustomTab && !tabs) diff --git a/app/src/main/res/layout/fragment_oauth.xml b/app/src/main/res/layout/fragment_oauth.xml index b9fa0e8493..051125b8f8 100644 --- a/app/src/main/res/layout/fragment_oauth.xml +++ b/app/src/main/res/layout/fragment_oauth.xml @@ -145,6 +145,18 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbRecent" /> + + + app:layout_constraintTop_toBottomOf="@id/tvEdge" /> Authorize access to your %1$s account Authorize an existing account again (otherwise create a new account) Account authorization was updated + When using Edge browser, make sure that \'Block opening external apps\' in the \'Privacy, security and services\' settings is off When using Brave browser, you must enable the option in Brave\'s settings to allow app links to open in apps outside of Brave Authorization requires a working browser Authorize