mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-29 13:53:16 -05:00
Show empty library message properly
Fixes #8632 The `library` map still contains the default category even when "empty".
This commit is contained in:
parent
217b03a292
commit
ac1bed38f9
2 changed files with 4 additions and 3 deletions
|
@ -134,7 +134,7 @@ object LibraryScreen : Screen {
|
||||||
return@Scaffold
|
return@Scaffold
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.searchQuery.isNullOrEmpty() && state.library.isEmpty()) {
|
if (state.searchQuery.isNullOrEmpty() && state.libraryCount == 0) {
|
||||||
val handler = LocalUriHandler.current
|
val handler = LocalUriHandler.current
|
||||||
EmptyScreen(
|
EmptyScreen(
|
||||||
textResource = R.string.information_empty_library,
|
textResource = R.string.information_empty_library,
|
||||||
|
@ -156,7 +156,7 @@ object LibraryScreen : Screen {
|
||||||
selection = state.selection,
|
selection = state.selection,
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
currentPage = { screenModel.activeCategory },
|
currentPage = { screenModel.activeCategory },
|
||||||
isLibraryEmpty = state.library.isEmpty(),
|
isLibraryEmpty = state.libraryCount == 0,
|
||||||
showPageTabs = state.showCategoryTabs,
|
showPageTabs = state.showCategoryTabs,
|
||||||
onChangeCurrentPage = { screenModel.activeCategory = it },
|
onChangeCurrentPage = { screenModel.activeCategory = it },
|
||||||
onMangaClicked = { router.openManga(it) },
|
onMangaClicked = { router.openManga(it) },
|
||||||
|
|
|
@ -10,6 +10,7 @@ import cafe.adriel.voyager.core.model.coroutineScope
|
||||||
import eu.kanade.core.prefs.CheckboxState
|
import eu.kanade.core.prefs.CheckboxState
|
||||||
import eu.kanade.core.prefs.PreferenceMutableState
|
import eu.kanade.core.prefs.PreferenceMutableState
|
||||||
import eu.kanade.core.prefs.asState
|
import eu.kanade.core.prefs.asState
|
||||||
|
import eu.kanade.core.util.fastDistinctBy
|
||||||
import eu.kanade.core.util.fastFilter
|
import eu.kanade.core.util.fastFilter
|
||||||
import eu.kanade.core.util.fastFilterNot
|
import eu.kanade.core.util.fastFilterNot
|
||||||
import eu.kanade.core.util.fastMapNotNull
|
import eu.kanade.core.util.fastMapNotNull
|
||||||
|
@ -750,7 +751,7 @@ class LibraryScreenModel(
|
||||||
val libraryCount by lazy {
|
val libraryCount by lazy {
|
||||||
library
|
library
|
||||||
.flatMap { (_, v) -> v }
|
.flatMap { (_, v) -> v }
|
||||||
.distinctBy { it.libraryManga.manga.id }
|
.fastDistinctBy { it.libraryManga.manga.id }
|
||||||
.size
|
.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue