pull/2622/head
kunfei 2 years ago
parent aa68694821
commit b5523f377e
  1. 5
      app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt

@ -131,10 +131,13 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>(),
waitDialog.show()
viewModel.upBookTocRule(book) {
waitDialog.dismiss()
}
ReadBook.book?.let { readBook ->
if (readBook == book) {
readBook.tocUrl = tocRegex
ReadBook.chapterSize = book.totalChapterNum
ReadBook.upMsg(null)
ReadBook.loadContent(resetPageOffset = true)
}
}
}
}

@ -6,7 +6,6 @@ import androidx.lifecycle.MutableLiveData
import io.legado.app.base.BaseViewModel
import io.legado.app.data.appDb
import io.legado.app.data.entities.Book
import io.legado.app.model.ReadBook
import io.legado.app.model.localBook.LocalBook
class TocViewModel(application: Application) : BaseViewModel(application) {
@ -34,9 +33,6 @@ class TocViewModel(application: Application) : BaseViewModel(application) {
appDb.bookChapterDao.delByBook(book.bookUrl)
appDb.bookChapterDao.insert(*it.toTypedArray())
appDb.bookDao.update(book)
ReadBook.chapterSize = it.size
ReadBook.upMsg(null)
ReadBook.loadContent(resetPageOffset = true)
}
}
}.onFinally {

Loading…
Cancel
Save