Fix WebView crash introduced in v0.19.2 (#2649)

(cherry picked from commit bdb0ce4779d565fc528e97bd38133a72ff3c1724)
This commit is contained in:
bapeey
2025-11-04 11:28:40 +05:45
committed by NGB-Was-Taken
parent 1fa8a86cce
commit 67c4b71b88
@@ -133,21 +133,20 @@ fun WebViewScreenContent(
view: WebView?,
request: WebResourceRequest?,
): Boolean {
request?.let {
// Don't attempt to open blobs as webpages
if (it.url.toString().startsWith("blob:http")) {
return false
}
val url = request?.url?.toString() ?: return false
// Ignore intents urls
if (it.url.toString().startsWith("intent://")) {
// Ignore intents urls
if (url.startsWith("intent://")) return true
// Only open valid web urls
if (url.startsWith("http") || url.startsWith("https")) {
if (url != view?.url) {
view?.loadUrl(url, headers)
return true
}
// Continue with request, but with custom headers
view?.loadUrl(it.url.toString(), headers)
}
return super.shouldOverrideUrlLoading(view, request)
return false
}
}
}