update
This commit is contained in:
parent
c2fd9c30ca
commit
8e4740c15d
1 changed files with 11 additions and 11 deletions
|
|
@ -60,6 +60,7 @@ class WebViewActivity : AppCompatActivity() {
|
|||
val webSettings: WebSettings = webView.settings
|
||||
webSettings.javaScriptEnabled = true
|
||||
webSettings.domStorageEnabled = true
|
||||
webSettings.cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK
|
||||
|
||||
webView.webViewClient = object : WebViewClient() {
|
||||
override fun onReceivedError(view: WebView?, request: WebResourceRequest?, error: WebResourceError?) {
|
||||
|
|
@ -70,17 +71,6 @@ class WebViewActivity : AppCompatActivity() {
|
|||
super.onPageFinished(view, url)
|
||||
injectJavaScript(view)
|
||||
}
|
||||
|
||||
private fun injectJavaScript(view: WebView?) {
|
||||
view?.evaluateJavascript(
|
||||
"""
|
||||
window.addEventListener('beforeinstallprompt', function(e) {
|
||||
e.preventDefault();
|
||||
console.log('Install prompt blocked by WebView');
|
||||
});
|
||||
""".trimIndent(), null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
webView.webChromeClient = object : WebChromeClient() {
|
||||
|
|
@ -102,6 +92,16 @@ class WebViewActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun injectJavaScript(view: WebView?) {
|
||||
view?.evaluateJavascript(
|
||||
"""
|
||||
window.addEventListener('beforeinstallprompt', function(e) {
|
||||
e.preventDefault();
|
||||
console.log('Install prompt blocked by WebView');
|
||||
});
|
||||
""".trimIndent(), null
|
||||
)
|
||||
}
|
||||
private fun launchFileChooser() {
|
||||
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
|
|
|
|||
Loading…
Reference in a new issue