From 14cf04a8ceda4fafa6e0591cca99165b0850823a Mon Sep 17 00:00:00 2001 From: Acclorite <2ma0bhpk@anonaddy.com> Date: Thu, 25 Sep 2025 20:42:54 +0300 Subject: [PATCH] fix: show default category when no other categories exist * Fixed bug where default category wasn't shown if no categories and books exist --- .../book_story/presentation/library/LibraryScreen.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/library/LibraryScreen.kt b/app/src/main/java/ua/acclorite/book_story/presentation/library/LibraryScreen.kt index 955ee81c..c5c3d18b 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/library/LibraryScreen.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/library/LibraryScreen.kt @@ -66,10 +66,12 @@ object LibraryScreen : Screen, Parcelable { settings.libraryShowDefaultTab.value ) { 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 -> book.data.categories.none { category -> category in categoryIds } - } || settingsState.value.categories.isEmpty() || settings.libraryShowDefaultTab.lastValue + } || categories.isEmpty() || settings.libraryShowDefaultTab.lastValue + } }