diff --git a/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoViewModel.kt index 8958c84d1..35776ef93 100644 --- a/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoViewModel.kt @@ -61,10 +61,12 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> WebBook(bookSource).getChapterList(book) .onSuccess(IO) { - if (inBookshelf) { - + it?.let { + if (inBookshelf) { + App.db.bookChapterDao().insert(*it.toTypedArray()) + } + chapterListData.postValue(it) } - chapterListData.postValue(it) }.onError { toast(R.string.error_get_chapter_list) }