mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 17:13:23 +02:00
@@ -24,6 +24,7 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
@@ -61,11 +62,12 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
private Button btnBiometrics;
|
||||
private Button btnPin;
|
||||
private Spinner spBiometricsTimeout;
|
||||
private SwitchCompat swSafeBrowsing;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"confirm_links", "confirm_images", "confirm_html",
|
||||
"disable_tracking", "display_hidden", "secure",
|
||||
"biometrics", "pin", "biometrics_timeout"
|
||||
"biometrics", "pin", "biometrics_timeout", "safe_browsing"
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -88,6 +90,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
btnBiometrics = view.findViewById(R.id.btnBiometrics);
|
||||
btnPin = view.findViewById(R.id.btnPin);
|
||||
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
|
||||
swSafeBrowsing = view.findViewById(R.id.swSafeBrowsing);
|
||||
|
||||
setOptions();
|
||||
|
||||
@@ -189,6 +192,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
}
|
||||
});
|
||||
|
||||
swSafeBrowsing.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? View.GONE : View.VISIBLE);
|
||||
swSafeBrowsing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("safe_browsing", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
return view;
|
||||
@@ -255,6 +266,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
spBiometricsTimeout.setSelection(pos);
|
||||
break;
|
||||
}
|
||||
|
||||
swSafeBrowsing.setChecked(prefs.getBoolean("safe_browsing", true));
|
||||
}
|
||||
|
||||
public static class FragmentDialogPin extends FragmentDialogBase {
|
||||
|
||||
@@ -20,6 +20,7 @@ package eu.faircode.email;
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.util.Pair;
|
||||
@@ -29,6 +30,8 @@ import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class WebViewEx extends WebView implements DownloadListener, View.OnLongClickListener {
|
||||
private int height;
|
||||
private IWebView intf;
|
||||
@@ -53,6 +56,12 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
||||
|
||||
settings.setAllowFileAccess(false);
|
||||
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean safe_browsing = prefs.getBoolean("safe_browsing", true);
|
||||
settings.setSafeBrowsingEnabled(safe_browsing);
|
||||
}
|
||||
}
|
||||
|
||||
void init(
|
||||
|
||||
Reference in New Issue
Block a user