去除检查书源调试信息配置

pull/1259/head
gedoor 3 years ago
parent 24d6894bb9
commit c2fa7c4ea1
  1. 13
      app/src/main/java/io/legado/app/service/CheckSourceService.kt
  2. 14
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -30,7 +30,6 @@ class CheckSourceService : BaseService() {
private val checkedIds = ArrayList<String>()
private var processIndex = 0
private var notificationMsg = ""
private val showCheckSourceMessage = AppConfig.checkSourceMessage
private val notificationBuilder by lazy {
NotificationCompat.Builder(this, AppConst.channelIdReadAloud)
.setSmallIcon(R.drawable.ic_network_check)
@ -109,9 +108,7 @@ class CheckSourceService : BaseService() {
fun check(source: BookSource) {
execute(context = searchCoroutine) {
if (showCheckSourceMessage) {
Debug.startChecking(source)
}
Debug.startChecking(source)
val webBook = WebBook(source)
var books = webBook.searchBookAwait(this, CheckSource.keyword)
if (books.isEmpty()) {
@ -141,9 +138,7 @@ class CheckSourceService : BaseService() {
"error:${it.localizedMessage}
${source.bookSourceComment}"
""".trimIndent()
if (showCheckSourceMessage) {
Debug.updateFinalMessage(source.bookSourceUrl, "失败")
}
Debug.updateFinalMessage(source.bookSourceUrl, "失败")
appDb.bookSourceDao.update(source)
}.onSuccess(searchCoroutine) {
source.removeGroup("失效")
@ -152,9 +147,7 @@ class CheckSourceService : BaseService() {
?.filterNot {
it.startsWith("error:")
}?.joinToString("\n")
if (showCheckSourceMessage) {
Debug.updateFinalMessage(source.bookSourceUrl, "成功")
}
Debug.updateFinalMessage(source.bookSourceUrl, "成功")
appDb.bookSourceDao.update(source)
}.onFinally(searchCoroutine) {
onNext(source.bookSourceUrl, source.bookSourceName)

@ -341,9 +341,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
}
}
CheckSource.start(this@BookSourceActivity, adapter.selection)
if(AppConfig.checkSourceMessage) {
checkMessageRefreshJob().start()
}
checkMessageRefreshJob().start()
}
noButton()
}.show()
@ -436,10 +434,12 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
.make(binding.root, msg, Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.cancel) {
CheckSource.stop(this)
if (AppConfig.checkSourceMessage) {
Debug.finishChecking()
adapter.notifyItemRangeChanged(0, adapter.itemCount, bundleOf(Pair("checkSourceMessage", null)))
}
Debug.finishChecking()
adapter.notifyItemRangeChanged(
0,
adapter.itemCount,
bundleOf(Pair("checkSourceMessage", null))
)
}.apply { show() }
}
}

Loading…
Cancel
Save