pull/306/head
gedoor 5 years ago
parent 83574a9086
commit f856969841
  1. 9
      app/src/main/java/io/legado/app/service/DownloadService.kt

@ -193,7 +193,8 @@ class DownloadService : BaseService() {
synchronized(this) { synchronized(this) {
downloadingList.remove(bookChapter.url) downloadingList.remove(bookChapter.url)
} }
Download.addLog(it.localizedMessage) Download.addLog("getContentError${it.localizedMessage}")
updateNotification("getContentError${it.localizedMessage}")
} }
.onSuccess(IO) { content -> .onSuccess(IO) { content ->
BookHelp.saveContent(book, bookChapter, content) BookHelp.saveContent(book, bookChapter, content)
@ -231,6 +232,7 @@ class DownloadService : BaseService() {
} }
}.onError { }.onError {
Download.addLog("ERROR:${it.localizedMessage}") Download.addLog("ERROR:${it.localizedMessage}")
updateNotification("ERROR:${it.localizedMessage}")
} }
tasks.add(task) tasks.add(task)
} }
@ -271,9 +273,8 @@ class DownloadService : BaseService() {
* 更新通知 * 更新通知
*/ */
private fun updateNotification(content: String) { private fun updateNotification(content: String) {
val builder = notificationBuilder notificationBuilder.setContentText(content)
builder.setContentText(content) val notification = notificationBuilder.build()
val notification = builder.build()
startForeground(AppConst.notificationIdDownload, notification) startForeground(AppConst.notificationIdDownload, notification)
} }

Loading…
Cancel
Save