BookInfoViewModel.kt:loadChapter 应该先把旧的chapterList数据清空

pull/1592/head
Xwite 3 years ago
parent 9faa327d99
commit 71ce2fe468
  1. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt

@ -118,6 +118,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
if (book.isLocalBook()) {
LocalBook.getChapterList(book).let {
appDb.bookDao.update(book)
appDb.bookChapterDao.delByBook(book.bookUrl)
appDb.bookChapterDao.insert(*it.toTypedArray())
chapterListData.postValue(it)
}
@ -127,6 +128,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
.onSuccess(IO) {
if (inBookshelf) {
appDb.bookDao.update(book)
appDb.bookChapterDao.delByBook(book.bookUrl)
appDb.bookChapterDao.insert(*it.toTypedArray())
}
if (changeDruChapterIndex == null) {

Loading…
Cancel
Save