mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Don't overwrite allCategories inside combine {}
This commit is contained in:
parent
547028776e
commit
1298ef7d40
1 changed files with 8 additions and 6 deletions
|
@ -801,16 +801,17 @@ class LibraryPresenter(
|
||||||
* If category id '-1' is not empty, it means the library not grouped by categories
|
* If category id '-1' is not empty, it means the library not grouped by categories
|
||||||
*/
|
*/
|
||||||
private fun getLibraryFlow(): Flow<LibraryData> {
|
private fun getLibraryFlow(): Flow<LibraryData> {
|
||||||
val libraryItemFlow = combine(
|
val libraryFlow = combine(
|
||||||
getCategories.subscribe(),
|
getCategories.subscribe(),
|
||||||
// FIXME: Remove retry once a real solution is found
|
// FIXME: Remove retry once a real solution is found
|
||||||
getLibraryManga.subscribe().retry(1) { e -> e is NullPointerException },
|
getLibraryManga.subscribe().retry(1) { e -> e is NullPointerException },
|
||||||
getPreferencesFlow(),
|
getPreferencesFlow(),
|
||||||
forceUpdateEvent.receiveAsFlow(),
|
forceUpdateEvent.receiveAsFlow(),
|
||||||
) { allCategories, libraryMangaList, prefs, _ ->
|
) { dbCategories, libraryMangaList, prefs, _ ->
|
||||||
groupType = prefs.groupType
|
groupType = prefs.groupType
|
||||||
|
|
||||||
val defaultCategory = createDefaultCategory()
|
val defaultCategory = createDefaultCategory()
|
||||||
allCategories = listOf(defaultCategory) + dbCategories
|
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) {
|
||||||
|
@ -831,13 +832,14 @@ class LibraryPresenter(
|
||||||
groupType,
|
groupType,
|
||||||
prefs.collapsedDynamicCategories,
|
prefs.collapsedDynamicCategories,
|
||||||
)
|
)
|
||||||
}
|
} to allCategories
|
||||||
}
|
}
|
||||||
|
|
||||||
return combine(
|
return combine(
|
||||||
libraryItemFlow,
|
libraryFlow,
|
||||||
preferences.removeArticles().changes(),
|
preferences.removeArticles().changes(),
|
||||||
) { libraryItems, removeArticles ->
|
) { library, removeArticles ->
|
||||||
|
val (libraryItems, allCategories) = library
|
||||||
val (items, categories, hiddenItems) = libraryItems
|
val (items, categories, hiddenItems) = libraryItems
|
||||||
|
|
||||||
LibraryData(
|
LibraryData(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue