|
@@ -8,7 +8,7 @@ import android.webkit.WebView
|
|
|
import io.legado.app.base.BaseViewModel
|
|
import io.legado.app.base.BaseViewModel
|
|
|
import io.legado.app.constant.AppConst.imagePathKey
|
|
import io.legado.app.constant.AppConst.imagePathKey
|
|
|
import io.legado.app.constant.SourceType
|
|
import io.legado.app.constant.SourceType
|
|
|
-import io.legado.app.data.appDb
|
|
|
|
|
|
|
+import io.legado.app.data.repository.BookSourceRepository
|
|
|
import io.legado.app.exception.NoStackTraceException
|
|
import io.legado.app.exception.NoStackTraceException
|
|
|
import io.legado.app.help.http.newCallResponseBody
|
|
import io.legado.app.help.http.newCallResponseBody
|
|
|
import io.legado.app.help.http.okHttpClient
|
|
import io.legado.app.help.http.okHttpClient
|
|
@@ -21,7 +21,10 @@ import io.legado.app.utils.printOnDebug
|
|
|
import io.legado.app.utils.toastOnUi
|
|
import io.legado.app.utils.toastOnUi
|
|
|
import org.apache.commons.text.StringEscapeUtils
|
|
import org.apache.commons.text.StringEscapeUtils
|
|
|
|
|
|
|
|
-class WebViewModel(application: Application) : BaseViewModel(application) {
|
|
|
|
|
|
|
+class WebViewModel(
|
|
|
|
|
+ application: Application,
|
|
|
|
|
+ private val bookSourceRepository: BookSourceRepository,
|
|
|
|
|
+) : BaseViewModel(application) {
|
|
|
var intent: Intent? = null
|
|
var intent: Intent? = null
|
|
|
var baseUrl: String = ""
|
|
var baseUrl: String = ""
|
|
|
var html: String? = null
|
|
var html: String? = null
|
|
@@ -97,7 +100,7 @@ class WebViewModel(application: Application) : BaseViewModel(application) {
|
|
|
if (refetchAfterSuccess) {
|
|
if (refetchAfterSuccess) {
|
|
|
execute {
|
|
execute {
|
|
|
val url = intent!!.getStringExtra("url")!!
|
|
val url = intent!!.getStringExtra("url")!!
|
|
|
- val source = appDb.bookSourceDao.getBookSource(sourceOrigin)
|
|
|
|
|
|
|
+ val source = bookSourceRepository.getBookSource(sourceOrigin)
|
|
|
html = AnalyzeUrl(
|
|
html = AnalyzeUrl(
|
|
|
url,
|
|
url,
|
|
|
headerMapF = headerMap,
|
|
headerMapF = headerMap,
|