Only show Webview update prompt if CF bypass fails

This commit is contained in:
arkon
2020-02-11 18:36:51 -05:00
parent f29124773b
commit a50a3df716
4 changed files with 48 additions and 34 deletions
@@ -1,19 +1,15 @@
package eu.kanade.tachiyomi.util.system
import android.webkit.WebView
import android.widget.Toast
import eu.kanade.tachiyomi.R
private val WEBVIEW_UA_VERSION_REGEX by lazy {
Regex(""".*Chrome/(\d+)\..*""")
}
private const val MINIMUM_WEBVIEW_VERSION = 72
private const val MINIMUM_WEBVIEW_VERSION = 70
fun WebView.checkVersion() {
if (getWebviewMajorVersion(this) < MINIMUM_WEBVIEW_VERSION) {
this.context.toast(R.string.information_webview_outdated, Toast.LENGTH_LONG)
}
fun WebView.isOutdated(): Boolean {
return getWebviewMajorVersion(this) < MINIMUM_WEBVIEW_VERSION
}
// Based on https://stackoverflow.com/a/29218966