mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-02-28 21:38:20 +03:00
Use WebSettingsCompat.setSafeBrowsingEnabled
This commit is contained in:
parent
87317c6faf
commit
b62a09b5b3
2 changed files with 9 additions and 7 deletions
|
@ -241,6 +241,7 @@ dependencies {
|
|||
implementation "androidx.work:work-runtime-ktx:${androidxWorkVersion}"
|
||||
implementation "androidx.work:work-rxjava3:${androidxWorkVersion}"
|
||||
implementation 'com.google.android.material:material:1.11.0'
|
||||
implementation "androidx.webkit:webkit:1.9.0"
|
||||
|
||||
/** Third-party libraries **/
|
||||
// Instance state boilerplate elimination
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.schabi.newpipe.util.potoken
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
|
@ -10,6 +9,8 @@ import android.webkit.JavascriptInterface
|
|||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebView
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.webkit.WebSettingsCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.core.SingleEmitter
|
||||
|
@ -31,14 +32,14 @@ class PoTokenWebView private constructor(
|
|||
|
||||
//region Initialization
|
||||
init {
|
||||
val webviewSettings = webView.settings
|
||||
val webViewSettings = webView.settings
|
||||
//noinspection SetJavaScriptEnabled we want to use JavaScript!
|
||||
webviewSettings.javaScriptEnabled = true
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
webviewSettings.safeBrowsingEnabled = false
|
||||
webViewSettings.javaScriptEnabled = true
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.SAFE_BROWSING_ENABLE)) {
|
||||
WebSettingsCompat.setSafeBrowsingEnabled(webViewSettings, false)
|
||||
}
|
||||
webviewSettings.userAgentString = USER_AGENT
|
||||
webviewSettings.blockNetworkLoads = true // the WebView does not need internet access
|
||||
webViewSettings.userAgentString = USER_AGENT
|
||||
webViewSettings.blockNetworkLoads = true // the WebView does not need internet access
|
||||
|
||||
// so that we can run async functions and get back the result
|
||||
webView.addJavascriptInterface(this, JS_INTERFACE)
|
||||
|
|
Loading…
Add table
Reference in a new issue