feat: 优化代码

pull/123/head
kunfei 5 years ago
parent 78781ff757
commit 0155f20451
  1. 21
      app/src/main/java/io/legado/app/help/http/AjaxWebView.kt

@ -1,7 +1,6 @@
package io.legado.app.help.http
import android.annotation.SuppressLint
import android.net.http.SslError
import android.os.Build
import android.os.Handler
import android.os.Looper
@ -9,11 +8,7 @@ import android.os.Message
import android.text.TextUtils
import android.webkit.*
import io.legado.app.App
import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.cancelButton
import io.legado.app.lib.dialogs.okButton
import org.apache.commons.text.StringEscapeUtils
import java.lang.ref.WeakReference
@ -171,14 +166,6 @@ class AjaxWebView {
).sendToTarget()
}
}
override fun onReceivedSslError(view: WebView, handler: SslErrorHandler, error: SslError) {
App.INSTANCE.alert(titleResource = R.string.sure) {
message = "${view.url}证书不匹配,是否继续访问"
okButton { handler.proceed() }
cancelButton { handler.cancel() }
}.show()
}
}
private class EvalJsRunnable(
@ -250,14 +237,6 @@ class AjaxWebView {
}
}
override fun onReceivedSslError(view: WebView, handler: SslErrorHandler, error: SslError) {
App.INSTANCE.alert(titleResource = R.string.sure) {
message = "${view.url}证书不匹配,是否继续访问"
okButton { handler.proceed() }
cancelButton { handler.cancel() }
}.show()
}
override fun onPageFinished(view: WebView, url: String) {
params.setCookie(url)
if (params.hasJavaScript()) {

Loading…
Cancel
Save