From 83af11a2517a9299e2788200444bbffabf9f1a82 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 23 Jul 2020 21:39:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4webView=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/help/http/AjaxWebView.kt | 55 ++----------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt b/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt index 4f5cbda46..a12816486 100644 --- a/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt +++ b/app/src/main/java/io/legado/app/help/http/AjaxWebView.kt @@ -1,12 +1,14 @@ package io.legado.app.help.http import android.annotation.SuppressLint -import android.os.Build import android.os.Handler import android.os.Looper import android.os.Message import android.text.TextUtils -import android.webkit.* +import android.webkit.CookieManager +import android.webkit.WebSettings +import android.webkit.WebView +import android.webkit.WebViewClient import io.legado.app.App import io.legado.app.constant.AppConst import org.apache.commons.text.StringEscapeUtils @@ -142,30 +144,6 @@ class AjaxWebView { handler.postDelayed(runnable, 1000) } - override fun onReceivedError( - view: WebView, - errorCode: Int, - description: String, - failingUrl: String - ) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { - handler.obtainMessage(MSG_ERROR, Exception(description)) - .sendToTarget() - } - } - - override fun onReceivedError( - view: WebView, - request: WebResourceRequest, - error: WebResourceError - ) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - handler.obtainMessage( - MSG_ERROR, - Exception(error.description.toString()) - ).sendToTarget() - } - } } private class EvalJsRunnable( @@ -213,31 +191,6 @@ class AjaxWebView { } } - override fun onReceivedError( - view: WebView, - errorCode: Int, - description: String, - failingUrl: String - ) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { - handler.obtainMessage(MSG_ERROR, Exception(description)) - .sendToTarget() - } - } - - override fun onReceivedError( - view: WebView, - request: WebResourceRequest, - error: WebResourceError - ) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - handler.obtainMessage( - MSG_ERROR, - Exception(error.description.toString()) - ).sendToTarget() - } - } - override fun onPageFinished(view: WebView, url: String) { params.setCookie(url) if (params.hasJavaScript()) {