feat: 添加下载错误日志,从下载菜单浏览

pull/274/head 3.20.070519
gedoor 4 years ago
parent 606de68a69
commit cc97b48a69
  1. 4
      app/src/main/java/io/legado/app/service/DownloadService.kt
  2. 3
      app/src/main/java/io/legado/app/service/help/Download.kt

@ -184,9 +184,7 @@ class DownloadService : BaseService() {
scope = this, scope = this,
context = searchPool context = searchPool
).onError { ).onError {
it.localizedMessage?.let { Download.addLog(it.localizedMessage)
Download.addLog(it)
}
}.onSuccess(IO) { content -> }.onSuccess(IO) { content ->
downloadCount[book.bookUrl]?.increaseSuccess() downloadCount[book.bookUrl]?.increaseSuccess()
BookHelp.saveContent(book, bookChapter, content) BookHelp.saveContent(book, bookChapter, content)

@ -9,7 +9,8 @@ object Download {
val logs = arrayListOf<String>() val logs = arrayListOf<String>()
fun addLog(log: String) { fun addLog(log: String?) {
log ?: return
synchronized(this) { synchronized(this) {
if (logs.size > 30) { if (logs.size > 30) {
logs.removeAt(0) logs.removeAt(0)

Loading…
Cancel
Save