mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -367,6 +367,7 @@ object CacheBook {
|
||||
downloadFinish(chapter, "获取正文失败\n${it.localizedMessage}", resetPageOffset)
|
||||
}.onCancel {
|
||||
onCancel(chapter.index)
|
||||
downloadFinish(chapter, "download canceled", resetPageOffset, true)
|
||||
}.onFinally {
|
||||
postEvent(EventBus.UP_DOWNLOAD, book.bookUrl)
|
||||
}.start()
|
||||
@@ -375,12 +376,14 @@ object CacheBook {
|
||||
private fun downloadFinish(
|
||||
chapter: BookChapter,
|
||||
content: String,
|
||||
resetPageOffset: Boolean = false
|
||||
resetPageOffset: Boolean = false,
|
||||
canceled: Boolean = false
|
||||
) {
|
||||
if (ReadBook.book?.bookUrl == book.bookUrl) {
|
||||
ReadBook.contentLoadFinish(
|
||||
book, chapter, content,
|
||||
resetPageOffset = resetPageOffset,
|
||||
canceled = canceled
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ object ReadBook : CoroutineScope by MainScope() {
|
||||
it,
|
||||
upContent,
|
||||
resetPageOffset,
|
||||
success
|
||||
success = success
|
||||
)
|
||||
} ?: download(
|
||||
downloadScope,
|
||||
@@ -685,10 +685,11 @@ object ReadBook : CoroutineScope by MainScope() {
|
||||
content: String,
|
||||
upContent: Boolean = true,
|
||||
resetPageOffset: Boolean,
|
||||
canceled: Boolean = false,
|
||||
success: (() -> Unit)? = null
|
||||
) {
|
||||
removeLoading(chapter.index)
|
||||
if (chapter.index !in durChapterIndex - 1..durChapterIndex + 1) {
|
||||
if (canceled || chapter.index !in durChapterIndex - 1..durChapterIndex + 1) {
|
||||
return
|
||||
}
|
||||
Coroutine.async {
|
||||
|
||||
Reference in New Issue
Block a user