This commit is contained in:
Horis committed 2022-12-24 16:41:55 +08:00
1 parent c9f847c4fd
commit badc984ecc
2 files changed
+10 -2

No files matched your search

@@ -84,7 +84,11 @@ class ExploreShowActivity : VMBaseActivity<ActivityExploreShowBinding, ExploreSh
}
override fun isInBookshelf(name: String, author: String): Boolean {
return viewModel.bookshelf.contains("$name-$author")
return if (author.isNotBlank()) {
viewModel.bookshelf.contains("$name-$author")
} else {
viewModel.bookshelf.any { it.startsWith("$name-") }
}
}
override fun showBookInfo(book: Book) {
@@ -408,7 +408,11 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
* 是否已经加入书架
*/
override fun isInBookshelf(name: String, author: String): Boolean {
return viewModel.bookshelf.contains("$name-$author")
return if (author.isNotBlank()) {
viewModel.bookshelf.contains("$name-$author")
} else {
viewModel.bookshelf.any { it.startsWith("$name-") }
}
}
/**