From 4b18cdf6cf8629e15f863e52b930f96013165117 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 14 Sep 2021 16:49:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/ReadBookViewModel.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index 5ddaa746d..0ccf1bf06 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -49,10 +49,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { private fun initBook(book: Book) { if (ReadBook.book?.bookUrl != book.bookUrl) { ReadBook.resetData(book) - if (!book.isLocalBook() && ReadBook.bookSource == null) { - autoChangeSource(book.name, book.author) - return - } isInitFinish = true if (ReadBook.chapterSize == 0) { if (book.tocUrl.isEmpty()) { @@ -77,10 +73,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { ReadBook.titleDate.postValue(book.name) ReadBook.upWebBook(book) isInitFinish = true - if (!book.isLocalBook() && ReadBook.bookSource == null) { - autoChangeSource(book.name, book.author) - return - } ReadBook.chapterSize = appDb.bookChapterDao.getChapterCount(book.bookUrl) if (ReadBook.chapterSize == 0) { if (book.tocUrl.isEmpty()) { @@ -99,6 +91,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { syncBookProgress(book) } } + if (!book.isLocalBook() && ReadBook.bookSource == null) { + autoChangeSource(book.name, book.author) + return + } } private fun loadBookInfo(book: Book) {