Skip to content

Conversation

@ikarenkov
Copy link
Contributor

No description provided.


override fun onReceivedError(view: WebView, errorCode: Int, description: String?, failingUrl: String) {
super.onReceivedError(view, errorCode, description, failingUrl)
if (!(errorCode == -10 && "about:blank" == failingUrl)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number

Copy link
Contributor

@BlizzedRu BlizzedRu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет переопределенного shouldInterceptRequest, соответственно и метод колбэка не дергается.

Возможно (подлежит обсуждению) стоит добавить игнорирование загрузки favicon в shouldInterceptRequest, это порождало какие-то ошибки на БСПБ, если фавикона нет. Например:

private const val FAVICON_URL_PATH = "favicon.ico"
private const val IMAGE_MIME_TYPE = "image/png"

 override fun shouldInterceptRequest(view: WebView, request: WebResourceRequest): WebResourceResponse? {
            // Ignoring initiated favicon request
            return if (request.url.lastPathSegment == FAVICON_URL_PATH) {
                WebResourceResponse(IMAGE_MIME_TYPE, null, null)
            } else {
                super.shouldInterceptRequest(view, request.also(onInterceptRequest()))
            }
        }

}
}

open fun getWebViewClient() = SimpleWebViewClient(this)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это не get, это create


import android.webkit.WebView

interface WebViewCallback {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onInterceptRequest и onStartPageLoading нигде не вызывается :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants