pull/1251/head
gedoor 3 years ago
parent 3c252f27c4
commit fd8ac3ed1d
  1. 24
      app/src/main/java/io/legado/app/model/ReadBook.kt

@ -18,6 +18,7 @@ import io.legado.app.ui.book.read.page.provider.ImageProvider
import io.legado.app.utils.msg import io.legado.app.utils.msg
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import splitties.init.appCtx import splitties.init.appCtx
import kotlin.math.max import kotlin.math.max
@ -150,6 +151,21 @@ object ReadBook {
delay(1000) delay(1000)
download(i) download(i)
} }
book?.let { book ->
//最后一章时检查更新
if (durChapterPos == 0 && durChapterIndex == chapterSize - 1) {
webBook?.getChapterList(this, book)
?.onSuccess(IO) { cList ->
if (book.bookUrl == ReadBook.book?.bookUrl
&& cList.size > chapterSize
) {
appDb.bookChapterDao.insert(*cList.toTypedArray())
chapterSize = cList.size
nextTextChapter ?: loadContent(1)
}
}
}
}
} }
return true return true
} else { } else {
@ -214,12 +230,6 @@ object ReadBook {
readAloud(!BaseReadAloudService.pause) readAloud(!BaseReadAloudService.pause)
} }
upReadStartTime() upReadStartTime()
book?.let { book ->
//最后一章时检查更新
if (durChapterPos == 0 && durChapterIndex == chapterSize - 1 && book.isOnLineTxt()) {
}
}
} }
/** /**
@ -269,7 +279,7 @@ object ReadBook {
fun loadContent( fun loadContent(
index: Int, index: Int,
upContent: Boolean = true, upContent: Boolean = true,
resetPageOffset: Boolean, resetPageOffset: Boolean = false,
success: (() -> Unit)? = null success: (() -> Unit)? = null
) { ) {
book?.let { book -> book?.let { book ->

Loading…
Cancel
Save