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) {