fix: show default category when no other categories exist
* Fixed bug where default category wasn't shown if no categories and books exist
This commit is contained in:
parent
c46ecb7ff0
commit
14cf04a8ce
1 changed files with 4 additions and 2 deletions
|
|
@ -66,10 +66,12 @@ object LibraryScreen : Screen, Parcelable {
|
||||||
settings.libraryShowDefaultTab.value
|
settings.libraryShowDefaultTab.value
|
||||||
) {
|
) {
|
||||||
derivedStateOf {
|
derivedStateOf {
|
||||||
val categoryIds = settingsState.value.categories.map { it.id }.toSet()
|
val categories = settingsState.value.categories.filterNot { it.id == -1 }
|
||||||
|
val categoryIds = categories.map { it.id }.toSet()
|
||||||
state.value.books.any { book ->
|
state.value.books.any { book ->
|
||||||
book.data.categories.none { category -> category in categoryIds }
|
book.data.categories.none { category -> category in categoryIds }
|
||||||
} || settingsState.value.categories.isEmpty() || settings.libraryShowDefaultTab.lastValue
|
} || categories.isEmpty() || settings.libraryShowDefaultTab.lastValue
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue