fix(library): Don't show Default category if it's empty

This commit is contained in:
Ahmad Ansori Palembani 2024-12-23 07:28:43 +07:00
parent 365d259e94
commit 90f5dfc55a
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -813,12 +813,11 @@ class LibraryPresenter(
groupType = prefs.groupType
val defaultCategory = createDefaultCategory()
val allCategories = listOf(defaultCategory) + dbCategories
// FIXME: Should return Map<Int, LibraryItem> where Int is category id
if (groupType <= BY_DEFAULT || !libraryIsGrouped) {
getLibraryItems(
allCategories, // FIXME: Don't depends on allCategories
dbCategories,
libraryMangaList,
prefs.sortingMode,
prefs.sortAscending,
@ -834,7 +833,7 @@ class LibraryPresenter(
groupType,
prefs.collapsedDynamicCategories,
)
} to allCategories
} to listOf(defaultCategory) + dbCategories
}
return combine(
@ -884,10 +883,10 @@ class LibraryPresenter(
} + (-1 to catItemAll) + (0 to LibraryHeaderItem({ categories.getOrDefault(0) }, 0))
).toMap()
// TODO
val map = libraryManga.groupBy {
categories.getOrDefault(it.category)
}
// TODO: -
// val map = libraryManga.groupBy {
// categories.getOrDefault(it.category)
// }
val items = if (libraryIsGrouped) {
libraryManga