From a214afd1cbe954d8a35b34115ea57b94b9f00108 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 17 Aug 2019 21:06:37 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/bookinfo/BookInfoViewModel.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) }