mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Element Call: display error dialog only when loading the main URL (#3962)
This commit is contained in:
committed by
GitHub
parent
5610b198d6
commit
67be3f0851
+18
-3
@@ -66,19 +66,34 @@ class WebViewWidgetMessageInterceptor(
|
|||||||
override fun onReceivedError(view: WebView?, request: WebResourceRequest?, error: WebResourceError?) {
|
override fun onReceivedError(view: WebView?, request: WebResourceRequest?, error: WebResourceError?) {
|
||||||
// No network for instance, transmit the error
|
// No network for instance, transmit the error
|
||||||
Timber.e("onReceivedError error: ${error?.errorCode} ${error?.description}")
|
Timber.e("onReceivedError error: ${error?.errorCode} ${error?.description}")
|
||||||
onError(error?.description?.toString())
|
|
||||||
|
// Only propagate the error if it happens while loading the current page
|
||||||
|
if (view?.url == request?.url.toString()) {
|
||||||
|
onError(error?.description.toString())
|
||||||
|
}
|
||||||
|
|
||||||
super.onReceivedError(view, request, error)
|
super.onReceivedError(view, request, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReceivedHttpError(view: WebView?, request: WebResourceRequest?, errorResponse: WebResourceResponse?) {
|
override fun onReceivedHttpError(view: WebView?, request: WebResourceRequest?, errorResponse: WebResourceResponse?) {
|
||||||
Timber.e("onReceivedHttpError error: ${errorResponse?.statusCode} ${errorResponse?.reasonPhrase}")
|
Timber.e("onReceivedHttpError error: ${errorResponse?.statusCode} ${errorResponse?.reasonPhrase}")
|
||||||
onError(errorResponse?.statusCode.toString())
|
|
||||||
|
// Only propagate the error if it happens while loading the current page
|
||||||
|
if (view?.url == request?.url.toString()) {
|
||||||
|
onError(errorResponse?.statusCode.toString())
|
||||||
|
}
|
||||||
|
|
||||||
super.onReceivedHttpError(view, request, errorResponse)
|
super.onReceivedHttpError(view, request, errorResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReceivedSslError(view: WebView?, handler: SslErrorHandler?, error: SslError?) {
|
override fun onReceivedSslError(view: WebView?, handler: SslErrorHandler?, error: SslError?) {
|
||||||
Timber.e("onReceivedSslError error: ${error?.primaryError}")
|
Timber.e("onReceivedSslError error: ${error?.primaryError}")
|
||||||
onError(error?.primaryError?.toString())
|
|
||||||
|
// Only propagate the error if it happens while loading the current page
|
||||||
|
if (view?.url == error?.url.toString()) {
|
||||||
|
onError(error?.toString())
|
||||||
|
}
|
||||||
|
|
||||||
super.onReceivedSslError(view, handler, error)
|
super.onReceivedSslError(view, handler, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user