feat: 修复下载bug

pull/274/head
gedoor 4 years ago
parent 999aa86f8d
commit d9c55c783d
  1. 10
      app/src/main/java/io/legado/app/service/DownloadService.kt

@ -88,17 +88,25 @@ class DownloadService : BaseService() {
private fun getBook(bookUrl: String): Book? {
var book = bookMap[bookUrl]
if (book == null) {
synchronized(this) {
book = bookMap[bookUrl]
if (book == null) {
book = App.db.bookDao().getBook(bookUrl)
}
if (book == null) {
removeDownload(bookUrl)
}
}
}
return book
}
private fun getWebBook(bookUrl: String, origin: String): WebBook? {
var webBook = webBookMap[origin]
if (webBook == null) {
synchronized(this) {
webBook = webBookMap[origin]
if (webBook == null) {
App.db.bookSourceDao().getBookSource(origin)?.let {
webBook = WebBook(it)
@ -107,6 +115,8 @@ class DownloadService : BaseService() {
if (webBook == null) {
removeDownload(bookUrl)
}
}
}
return webBook
}

Loading…
Cancel
Save