Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Sep 9, 2024
1 parent 0d7690b commit 71038ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/main/java/io/legado/app/ui/browser/WebViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import io.legado.app.base.BaseViewModel
import io.legado.app.constant.AppConst
import io.legado.app.data.appDb
import io.legado.app.exception.NoStackTraceException
import io.legado.app.help.CacheManager
import io.legado.app.help.IntentData
import io.legado.app.help.http.newCallResponseBody
import io.legado.app.help.http.okHttpClient
Expand Down Expand Up @@ -97,7 +96,7 @@ class WebViewModel(application: Application) : BaseViewModel(application) {

fun saveVerificationResult(webView: WebView, success: () -> Unit) {
if (!sourceVerificationEnable) {
execute { success.invoke() }
return success.invoke()
}
if (refetchAfterSuccess) {
execute {
Expand All @@ -109,13 +108,15 @@ class WebViewModel(application: Application) : BaseViewModel(application) {
source = source
).getStrResponseAwait(useWebView = false).body
SourceVerificationHelp.setResult(sourceOrigin, html ?: "")
}.onSuccess {
success.invoke()
}
} else {
webView.evaluateJavascript("document.documentElement.outerHTML") {
execute {
html = StringEscapeUtils.unescapeJson(it).trim('"')
SourceVerificationHelp.setResult(sourceOrigin, html ?: "")
}.onSuccess {
success.invoke()
}
}
Expand Down

0 comments on commit 71038ab

Please sign in to comment.