pull/1319/head
gedoor 3 years ago
parent a950f9ec3d
commit fc9bfe5395
  1. 4
      app/src/main/java/io/legado/app/model/CacheBook.kt
  2. 1
      app/src/main/java/io/legado/app/service/CacheBookService.kt

@ -70,10 +70,10 @@ class CacheBook(var bookSource: BookSource, var book: Book) {
} }
} }
fun start(context: Context, book: Book, start: Int, end: Int) { fun start(context: Context, bookUrl: String, start: Int, end: Int) {
context.startService<CacheBookService> { context.startService<CacheBookService> {
action = IntentAction.start action = IntentAction.start
putExtra("bookUrl", book.bookUrl) putExtra("bookUrl", bookUrl)
putExtra("start", start) putExtra("start", start)
putExtra("end", end) putExtra("end", end)
} }

@ -76,6 +76,7 @@ class CacheBookService : BaseService() {
execute { execute {
val cacheBook = CacheBook.getOrCreate(bookUrl) ?: return@execute val cacheBook = CacheBook.getOrCreate(bookUrl) ?: return@execute
cacheBook.addDownload(start, end) cacheBook.addDownload(start, end)
upNotification(CacheBook.downloadSummary)
if (downloadJob == null) { if (downloadJob == null) {
download() download()
} }

Loading…
Cancel
Save