diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 503f629a29..9c5b454708 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -55,7 +55,7 @@
android:value="true" />
+ android:value="true" />
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java
index 6e073fe0c6..2c1829e6b1 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsPrivacy.java
@@ -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 {
diff --git a/app/src/main/java/eu/faircode/email/WebViewEx.java b/app/src/main/java/eu/faircode/email/WebViewEx.java
index b909e01ec1..b5d9ecd311 100644
--- a/app/src/main/java/eu/faircode/email/WebViewEx.java
+++ b/app/src/main/java/eu/faircode/email/WebViewEx.java
@@ -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(
diff --git a/app/src/main/res/layout/fragment_options_privacy.xml b/app/src/main/res/layout/fragment_options_privacy.xml
index e9d2ff62e9..5791088f46 100644
--- a/app/src/main/res/layout/fragment_options_privacy.xml
+++ b/app/src/main/res/layout/fragment_options_privacy.xml
@@ -231,5 +231,17 @@
android:entries="@array/biometricsTimeoutNames"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBiometricsTimeout" />
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9d34fc4337..07f342c65e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -406,16 +406,18 @@
Show reformatted messages by default
Automatically recognize and disable tracking images
Display hidden message texts
+ Hide from recent apps screen and prevent taking screenshots
+ PIN
+ Biometric authentication timeout
+ Safe browsing
+
Default encryption method
- OpenPGP provider
- Use Autocrypt
- Autocrypt mutual mode
Sign by default
Encrypt by default
Automatically decrypt messages
- Hide from recent apps screen and prevent taking screenshots
- PIN
- Biometric authentication timeout
+ OpenPGP provider
+ Use Autocrypt
+ Autocrypt mutual mode
Manage public keys
Import private key
Manage private keys