From 400c135530fd074893e3063c345ef950e680d829 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 13 Feb 2022 21:55:55 +0100 Subject: [PATCH] Check if safe browsing can be enabled --- app/src/main/java/eu/faircode/email/ActivityAMP.java | 4 ++-- .../main/java/eu/faircode/email/FragmentDialogOpenFull.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityAMP.java b/app/src/main/java/eu/faircode/email/ActivityAMP.java index b113cb9fca..26cdf0205d 100644 --- a/app/src/main/java/eu/faircode/email/ActivityAMP.java +++ b/app/src/main/java/eu/faircode/email/ActivityAMP.java @@ -102,8 +102,8 @@ public class ActivityAMP extends ActivityBase { settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - settings.setSafeBrowsingEnabled(safe_browsing); + if (WebViewEx.isFeatureSupported(WebViewFeature.SAFE_BROWSING_ENABLE)) + WebSettingsCompat.setSafeBrowsingEnabled(settings, safe_browsing); setDarkMode(); diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogOpenFull.java b/app/src/main/java/eu/faircode/email/FragmentDialogOpenFull.java index 9edeb2defb..10a8ed7bed 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogOpenFull.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogOpenFull.java @@ -82,8 +82,8 @@ public class FragmentDialogOpenFull extends FragmentDialogBase { settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - settings.setSafeBrowsingEnabled(safe_browsing); + if (WebViewEx.isFeatureSupported(WebViewFeature.SAFE_BROWSING_ENABLE)) + WebSettingsCompat.setSafeBrowsingEnabled(settings, safe_browsing); boolean dark = (Helper.isDarkTheme(context) && !force_light); if (WebViewEx.isFeatureSupported(WebViewFeature.FORCE_DARK))