pull/1738/head
kunfei 3 years ago
parent 7c8010c39a
commit e9de5eb857
  1. 12
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@ -192,6 +192,18 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
book.durChapterTitle = chapters[book.durChapterIndex].getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
)
ensureActive()
val nextChapter = chapters.getOrElse(book.durChapterIndex) {
chapters.first()
}
WebBook.getContentAwait(
this,
bookSource = source,
book = book,
bookChapter = chapters[book.durChapterIndex],
nextChapterUrl = nextChapter.url
)
ensureActive()
oldBook.changeTo(book)
appDb.bookChapterDao.insert(*chapters.toTypedArray())
ReadBook.resetData(book)

Loading…
Cancel
Save