优化
This commit is contained in:
@@ -18,6 +18,7 @@ import io.legado.app.help.coroutine.Coroutine
|
|||||||
import io.legado.app.utils.runOnUI
|
import io.legado.app.utils.runOnUI
|
||||||
import kotlinx.coroutines.Runnable
|
import kotlinx.coroutines.Runnable
|
||||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
|
import kotlinx.coroutines.withTimeout
|
||||||
import org.apache.commons.text.StringEscapeUtils
|
import org.apache.commons.text.StringEscapeUtils
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
@@ -42,7 +43,8 @@ class BackstageWebView(
|
|||||||
private var callback: Callback? = null
|
private var callback: Callback? = null
|
||||||
private var mWebView: WebView? = null
|
private var mWebView: WebView? = null
|
||||||
|
|
||||||
suspend fun getStrResponse(): StrResponse = suspendCancellableCoroutine { block ->
|
suspend fun getStrResponse(): StrResponse = withTimeout(60000L) {
|
||||||
|
suspendCancellableCoroutine { block ->
|
||||||
block.invokeOnCancellation {
|
block.invokeOnCancellation {
|
||||||
runOnUI {
|
runOnUI {
|
||||||
destroy()
|
destroy()
|
||||||
@@ -67,6 +69,7 @@ class BackstageWebView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getEncoding(): String {
|
private fun getEncoding(): String {
|
||||||
return encode ?: "utf-8"
|
return encode ?: "utf-8"
|
||||||
|
|||||||
Reference in New Issue
Block a user