Merge pull request #1319 from h11128/fix-sourceComment-no-align

两个小优化
pull/1327/head
kunfei 3 years ago committed by GitHub
commit dac094e814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      app/src/main/java/io/legado/app/service/CheckSourceService.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -142,19 +142,18 @@ class CheckSourceService : BaseService() {
}.timeout(180000L) }.timeout(180000L)
.onError(searchCoroutine) { .onError(searchCoroutine) {
source.addGroup("失效") source.addGroup("失效")
source.bookSourceComment = """ if (source.bookSourceComment?.contains("Error: ") == false) {
"error:${it.localizedMessage} source.bookSourceComment = "Error: ${it.localizedMessage} \n\n" + "${source.bookSourceComment}"
${source.bookSourceComment}" }
""".trimIndent()
Debug.updateFinalMessage(source.bookSourceUrl, "失败:${it.localizedMessage}") Debug.updateFinalMessage(source.bookSourceUrl, "失败:${it.localizedMessage}")
source.respondTime = Debug.getRespondTime(source.bookSourceUrl) source.respondTime = Debug.getRespondTime(source.bookSourceUrl)
appDb.bookSourceDao.update(source) appDb.bookSourceDao.update(source)
}.onSuccess(searchCoroutine) { }.onSuccess(searchCoroutine) {
source.removeGroup("失效") source.removeGroup("失效")
source.bookSourceComment = source.bookSourceComment source.bookSourceComment = source.bookSourceComment
?.split("\n") ?.split("\n\n")
?.filterNot { ?.filterNot {
it.startsWith("error:") it.startsWith("Error: ")
}?.joinToString("\n") }?.joinToString("\n")
Debug.updateFinalMessage(source.bookSourceUrl, "成功") Debug.updateFinalMessage(source.bookSourceUrl, "成功")
source.respondTime = Debug.getRespondTime(source.bookSourceUrl) source.respondTime = Debug.getRespondTime(source.bookSourceUrl)

@ -467,7 +467,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
snackBar?.dismiss() snackBar?.dismiss()
snackBar = null snackBar = null
groups.map { group -> groups.map { group ->
if (group.contains("失效")) { if (group.contains("失效") && searchView.query.isEmpty()) {
searchView.setQuery("失效", true) searchView.setQuery("失效", true)
toastOnUi("发现有失效书源,已为您自动筛选!") toastOnUi("发现有失效书源,已为您自动筛选!")
} }

Loading…
Cancel
Save