debug添加查看源码

pull/931/head
gedoor 4 years ago
parent 645333a12b
commit 9d3d4824e7
  1. 2
      app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt
  2. 1
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt
  3. 1
      app/src/main/java/io/legado/app/model/webBook/BookInfo.kt
  4. 1
      app/src/main/java/io/legado/app/model/webBook/BookList.kt
  5. 14
      app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt
  6. 13
      app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugModel.kt

@ -32,7 +32,7 @@ object BookChapterList {
appCtx.getString(R.string.error_get_web_content, baseUrl)
)
Debug.log(bookSource.bookSourceUrl, "≡获取成功:${baseUrl}")
Debug.log(bookSource.bookSourceUrl, body, state = 30)
val tocRule = bookSource.getTocRule()
val nextUrlList = arrayListOf(baseUrl)
var reverse = false

@ -33,6 +33,7 @@ object BookContent {
appCtx.getString(R.string.error_get_web_content, baseUrl)
)
Debug.log(bookSource.bookSourceUrl, "≡获取成功:${baseUrl}")
Debug.log(bookSource.bookSourceUrl, body, state = 40)
val mNextChapterUrl = if (!nextChapterUrl.isNullOrEmpty()) {
nextChapterUrl
} else {

@ -29,6 +29,7 @@ object BookInfo {
appCtx.getString(R.string.error_get_web_content, baseUrl)
)
Debug.log(bookSource.bookSourceUrl, "≡获取成功:${baseUrl}")
Debug.log(bookSource.bookSourceUrl, body, state = 20)
val analyzeRule = AnalyzeRule(book)
analyzeRule.setContent(body).setBaseUrl(baseUrl)
analyzeRule.setRedirectUrl(redirectUrl)

@ -36,6 +36,7 @@ object BookList {
)
)
Debug.log(bookSource.bookSourceUrl, "≡获取成功:${analyzeUrl.ruleUrl}")
Debug.log(bookSource.bookSourceUrl, body, state = 10)
val analyzeRule = AnalyzeRule(variableBook)
analyzeRule.setContent(body).setBaseUrl(baseUrl)
analyzeRule.setRedirectUrl(baseUrl)

@ -96,8 +96,18 @@ class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookS
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_scan -> {
qrCodeResult.launch(null)
R.id.menu_scan -> qrCodeResult.launch(null)
R.id.menu_search_src -> {
}
R.id.menu_book_src -> {
}
R.id.menu_toc_src -> {
}
R.id.menu_content_src -> {
}
R.id.menu_help -> showHelp()
}

@ -10,8 +10,11 @@ class BookSourceDebugModel(application: Application) : BaseViewModel(application
Debug.Callback {
private var webBook: WebBook? = null
private var callback: ((Int, String) -> Unit)? = null
var searchSrc: String? = null
var bookSrc: String? = null
var tocSrc: String? = null
var contentSrc: String? = null
fun init(sourceUrl: String?) {
sourceUrl?.let {
@ -39,7 +42,13 @@ class BookSourceDebugModel(application: Application) : BaseViewModel(application
}
override fun printLog(state: Int, msg: String) {
callback?.invoke(state, msg)
when (state) {
10 -> searchSrc = msg
20 -> bookSrc = msg
30 -> tocSrc = msg
40 -> contentSrc = msg
else -> callback?.invoke(state, msg)
}
}
override fun onCleared() {

Loading…
Cancel
Save