Added setting to disable safe browsing

Closes #175
This commit is contained in:
M66B
2020-03-12 08:24:10 +01:00
parent ae1c03cb87
commit 26eee7fd76
5 changed files with 45 additions and 9 deletions

View File

@@ -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(