-
Notifications
You must be signed in to change notification settings - Fork 7
Add webview delegate #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| override fun onReceivedError(view: WebView, errorCode: Int, description: String?, failingUrl: String) { | ||
| super.onReceivedError(view, errorCode, description, failingUrl) | ||
| if (!(errorCode == -10 && "about:blank" == failingUrl)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number
BlizzedRu
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onInterceptRequest и onStartPageLoading нигде не вызывается :(
No description provided.