mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-18 23:17:28 +01:00
Enable more WebView settings to better mimic regular browser
This commit is contained in:
@@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.util.system
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
|
||||
object WebViewUtil {
|
||||
@@ -29,6 +30,18 @@ fun WebView.isOutdated(): Boolean {
|
||||
return getWebViewMajorVersion(this) < WebViewUtil.MINIMUM_WEBVIEW_VERSION
|
||||
}
|
||||
|
||||
fun WebView.setDefaultSettings() {
|
||||
with(settings) {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
databaseEnabled = true
|
||||
setAppCacheEnabled(true)
|
||||
useWideViewPort = true
|
||||
loadWithOverviewMode = true
|
||||
cacheMode = WebSettings.LOAD_DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
// Based on https://stackoverflow.com/a/29218966
|
||||
private fun getWebViewMajorVersion(webview: WebView): Int {
|
||||
val originalUA: String = webview.settings.userAgentString
|
||||
|
||||
Reference in New Issue
Block a user