mirror of https://github.com/M66B/FairEmail.git
Added remark for Brave browser
This commit is contained in:
parent
996c10da7a
commit
1431fcb634
|
@ -28,6 +28,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
|
@ -35,6 +36,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
|
@ -89,6 +91,7 @@ import java.util.Date;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.mail.AuthenticationFailedException;
|
||||
|
@ -119,6 +122,7 @@ public class FragmentOAuth extends FragmentBase {
|
|||
private CheckBox cbPop;
|
||||
private CheckBox cbRecent;
|
||||
private CheckBox cbUpdate;
|
||||
private TextView tvBrave;
|
||||
private Button btnOAuth;
|
||||
private ContentLoadingProgressBar pbOAuth;
|
||||
private TextView tvConfiguring;
|
||||
|
@ -175,6 +179,7 @@ public class FragmentOAuth extends FragmentBase {
|
|||
cbPop = view.findViewById(R.id.cbPop);
|
||||
cbRecent = view.findViewById(R.id.cbRecent);
|
||||
cbUpdate = view.findViewById(R.id.cbUpdate);
|
||||
tvBrave = view.findViewById(R.id.tvBrave);
|
||||
btnOAuth = view.findViewById(R.id.btnOAuth);
|
||||
pbOAuth = view.findViewById(R.id.pbOAuth);
|
||||
tvConfiguring = view.findViewById(R.id.tvConfiguring);
|
||||
|
@ -235,6 +240,28 @@ public class FragmentOAuth extends FragmentBase {
|
|||
btnOAuth.setPaddingRelative(dp12, 0, dp12, 0);
|
||||
}
|
||||
|
||||
|
||||
boolean brave = false;
|
||||
try {
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW)
|
||||
.addCategory(Intent.CATEGORY_BROWSABLE)
|
||||
.setData(Uri.parse("http://example.com"));
|
||||
int flags = (Build.VERSION.SDK_INT < Build.VERSION_CODES.M ? 0 : PackageManager.MATCH_ALL);
|
||||
List<ResolveInfo> browsers = pm.queryIntentActivities(intent, flags);
|
||||
for (ResolveInfo browser : browsers)
|
||||
if (browser.activityInfo.packageName.startsWith("com.brave.browser")) {
|
||||
// _beta _nightly
|
||||
brave = true;
|
||||
break;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
brave = true;
|
||||
}
|
||||
|
||||
tvBrave.setVisibility(brave ? View.VISIBLE : View.GONE);
|
||||
|
||||
btnOAuth.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -130,6 +130,17 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbRecent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBrave"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_setup_oauth_brave"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="bold|italic"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbUpdate" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOAuth"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -140,7 +151,7 @@
|
|||
android:tag="disable"
|
||||
android:text="@string/title_setup_oauth_authorize"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbUpdate" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBrave" />
|
||||
|
||||
<eu.faircode.email.ContentLoadingProgressBar
|
||||
android:id="@+id/pbOAuth"
|
||||
|
|
|
@ -240,6 +240,7 @@
|
|||
<string name="title_setup_oauth_rationale">Authorize access to your %1$s account</string>
|
||||
<string name="title_setup_oauth_update">Authorize an existing account again (otherwise create a new account)</string>
|
||||
<string name="title_setup_oauth_updated">Account authorization was updated</string>
|
||||
<string name="title_setup_oauth_brave">When using Brave browser, you must enable the option in Brave\'s settings to allow apps links to open in apps outside of Brave</string>
|
||||
<string name="title_setup_oauth_authorize">Authorize</string>
|
||||
<string name="title_setup_select_account">Select account</string>
|
||||
<string name="title_setup_instructions">Setup instructions</string>
|
||||
|
|
Loading…
Reference in New Issue