From 7898997516ef1dcd116cd06f04a725f82f5943d7 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Fri, 13 May 2022 12:14:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=85=A5=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E6=96=87=E4=BB=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/info/BookInfoViewModel.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index a0f9e71b0..7a029f588 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -78,7 +78,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { isImportBookOnLine = (bookSource?.bookSourceType ?: BookType.local) == BookType.file if (book.tocUrl.isEmpty()) { loadBookInfo(book) - } else if (!isImportBookOnLine) { + } else if (isImportBookOnLine) { + chapterListData.postValue(emptyList()) + } else { val chapterList = appDb.bookChapterDao.getChapterList(book.bookUrl) if (chapterList.isNotEmpty()) { chapterListData.postValue(chapterList) @@ -111,7 +113,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { execute(scope) { if (book.isLocalBook()) { loadChapter(book, scope) - } else if (!isImportBookOnLine) { + } else { bookSource?.let { bookSource -> WebBook.getBookInfo(this, bookSource, book, canReName = canReName) .onSuccess(IO) { @@ -144,7 +146,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { appDb.bookChapterDao.insert(*it.toTypedArray()) chapterListData.postValue(it) } - } else if(!isImportBookOnLine) { + } else if (isImportBookOnLine) { chapterListData.postValue(emptyList()) } else { bookSource?.let { bookSource ->