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 60b40e089..53b7366b9 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 @@ -12,6 +12,7 @@ import io.legado.app.help.BookHelp import io.legado.app.model.WebBook import io.legado.app.model.localBook.AnalyzeTxtFile import io.legado.app.model.localBook.LocalBook +import io.legado.app.service.help.ReadBook import kotlinx.coroutines.Dispatchers.IO class BookInfoViewModel(application: Application) : BaseViewModel(application) { @@ -178,6 +179,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { book.durChapterTitle = it.durChapterTitle } App.db.bookDao().insert(book) + if (ReadBook.book?.name == book.name && ReadBook.book?.author == book.author) { + ReadBook.book = book + } } }.onSuccess { success?.invoke()