fix: 修复购买操作脚本执行问题

pull/2156/head
Odomu 2 years ago
parent 24e56e02ec
commit 23031ee6fe
  1. 22
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -17,17 +17,13 @@ import io.legado.app.BuildConfig
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.* import io.legado.app.constant.*
import io.legado.app.data.appDb import io.legado.app.data.appDb
import io.legado.app.data.entities.Book import io.legado.app.data.entities.*
import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookProgress
import io.legado.app.data.entities.BookSource
import io.legado.app.exception.NoStackTraceException import io.legado.app.exception.NoStackTraceException
import io.legado.app.help.AppWebDav import io.legado.app.help.*
import io.legado.app.help.BookHelp
import io.legado.app.help.IntentData
import io.legado.app.help.config.ReadBookConfig import io.legado.app.help.config.ReadBookConfig
import io.legado.app.help.config.ReadTipConfig import io.legado.app.help.config.ReadTipConfig
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.http.CookieStore
import io.legado.app.help.storage.Backup import io.legado.app.help.storage.Backup
import io.legado.app.lib.dialogs.SelectItem import io.legado.app.lib.dialogs.SelectItem
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
@ -969,14 +965,18 @@ class ReadBookActivity : BaseReadBookActivity(),
throw NoStackTraceException("no pay action") throw NoStackTraceException("no pay action")
} }
JsUtils.evalJs(payAction) { JsUtils.evalJs(payAction) {
it["java"] = source
it["source"] = source
it["book"] = book it["book"] = book
it["chapter"] = chapter it["chapter"] = chapter
} }
}.onSuccess { }.onSuccess {
startActivity<WebViewActivity> { if (it.isNotBlank()) {
putExtra("title", getString(R.string.chapter_pay)) startActivity<WebViewActivity> {
putExtra("url", it) putExtra("title", getString(R.string.chapter_pay))
IntentData.put(it, ReadBook.bookSource?.getHeaderMap(true)) putExtra("url", it)
IntentData.put(it, ReadBook.bookSource?.getHeaderMap(true))
}
} }
}.onError { }.onError {
toastOnUi(it.localizedMessage) toastOnUi(it.localizedMessage)

Loading…
Cancel
Save