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