From c8bd22eb1e8155a0fbbc32627cb041e1e2c7e218 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 14 Dec 2021 17:06:05 +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 --- .../java/io/legado/app/ui/book/info/BookInfoViewModel.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 0b8ecb72b..95ba3e263 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 @@ -35,11 +35,16 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { execute { val name = intent.getStringExtra("name") ?: "" val author = intent.getStringExtra("author") ?: "" + val bookUrl = intent.getStringExtra("bookUrl") ?: "" appDb.bookDao.getBook(name, author)?.let { book -> inBookshelf = true setBook(book) - } ?: appDb.searchBookDao.getFirstByNameAuthor(name, author)?.toBook()?.let { book -> - setBook(book) + } ?: let { + val searchBook = appDb.searchBookDao.getSearchBook(bookUrl) + ?: appDb.searchBookDao.getFirstByNameAuthor(name, author) + searchBook?.toBook()?.let { book -> + setBook(book) + } } } }