|
|
@ -1,13 +1,13 @@ |
|
|
|
package io.legado.app.help |
|
|
|
package io.legado.app.help |
|
|
|
|
|
|
|
|
|
|
|
import io.legado.app.utils.startActivity |
|
|
|
|
|
|
|
import io.legado.app.constant.AppLog |
|
|
|
import io.legado.app.constant.AppLog |
|
|
|
import io.legado.app.exception.NoStackTraceException |
|
|
|
|
|
|
|
import io.legado.app.data.entities.BaseSource |
|
|
|
import io.legado.app.data.entities.BaseSource |
|
|
|
import io.legado.app.ui.browser.WebViewActivity |
|
|
|
import io.legado.app.exception.NoStackTraceException |
|
|
|
import io.legado.app.ui.association.VerificationCodeActivity |
|
|
|
import io.legado.app.ui.association.VerificationCodeActivity |
|
|
|
import splitties.init.appCtx |
|
|
|
import io.legado.app.ui.browser.WebViewActivity |
|
|
|
|
|
|
|
import io.legado.app.utils.startActivity |
|
|
|
import kotlinx.coroutines.runBlocking |
|
|
|
import kotlinx.coroutines.runBlocking |
|
|
|
|
|
|
|
import splitties.init.appCtx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object SourceVerificationHelp { |
|
|
|
object SourceVerificationHelp { |
|
|
@ -19,13 +19,13 @@ object SourceVerificationHelp { |
|
|
|
fun getVerificationResult(source: BaseSource?, url: String, title: String, useBrowser: Boolean): String { |
|
|
|
fun getVerificationResult(source: BaseSource?, url: String, title: String, useBrowser: Boolean): String { |
|
|
|
source ?: throw NoStackTraceException("getVerificationResult parameter source cannot be null") |
|
|
|
source ?: throw NoStackTraceException("getVerificationResult parameter source cannot be null") |
|
|
|
return runBlocking { |
|
|
|
return runBlocking { |
|
|
|
val key = "${source?.getKey() ?: ""}_verificationResult" |
|
|
|
val key = "${source.getKey()}_verificationResult" |
|
|
|
CacheManager.delete(key) |
|
|
|
CacheManager.delete(key) |
|
|
|
|
|
|
|
|
|
|
|
if (!useBrowser) { |
|
|
|
if (!useBrowser) { |
|
|
|
appCtx.startActivity<VerificationCodeActivity> { |
|
|
|
appCtx.startActivity<VerificationCodeActivity> { |
|
|
|
putExtra("imageUrl", url) |
|
|
|
putExtra("imageUrl", url) |
|
|
|
putExtra("sourceOrigin", source?.getKey()) |
|
|
|
putExtra("sourceOrigin", source.getKey()) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
startBrowser(source, url, title, true) |
|
|
|
startBrowser(source, url, title, true) |
|
|
@ -39,10 +39,8 @@ object SourceVerificationHelp { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
CacheManager.get(key)!!.let { |
|
|
|
CacheManager.get(key)!!.let { |
|
|
|
if (it.isBlank()) { |
|
|
|
it.ifBlank { |
|
|
|
throw NoStackTraceException("验证结果为空") |
|
|
|
throw NoStackTraceException("验证结果为空") |
|
|
|
} else { |
|
|
|
|
|
|
|
it |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -57,9 +55,9 @@ object SourceVerificationHelp { |
|
|
|
appCtx.startActivity<WebViewActivity> { |
|
|
|
appCtx.startActivity<WebViewActivity> { |
|
|
|
putExtra("title", title) |
|
|
|
putExtra("title", title) |
|
|
|
putExtra("url", url) |
|
|
|
putExtra("url", url) |
|
|
|
putExtra("sourceOrigin", source?.getKey()) |
|
|
|
putExtra("sourceOrigin", source.getKey()) |
|
|
|
putExtra("sourceVerificationEnable", saveResult) |
|
|
|
putExtra("sourceVerificationEnable", saveResult) |
|
|
|
IntentData.put(url, source?.getHeaderMap(true)) |
|
|
|
IntentData.put(url, source.getHeaderMap(true)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|