From 75c19cae68fbf8dc4a469bb0aabb9afc08943dc1 Mon Sep 17 00:00:00 2001 From: FX192 <120828496+FX192@users.noreply.github.com> Date: Wed, 18 Nov 2026 18:28:35 +0300 Subject: [PATCH 1/2] fix(library): hide the Favorites soundtrack collection until it has a track --- .../launcher/frontend/SoundtrackCollections.kt | 5 +++-- .../java/com/droiddeck/launcher/ui/LibraryPage.kt | 2 +- .../launcher/frontend/SoundtrackCollectionsTest.kt | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/frontend/SoundtrackCollections.kt b/app/src/main/java/com/droiddeck/launcher/frontend/SoundtrackCollections.kt index d680ae0709..9eebd911bc 100644 --- a/app/src/main/java/com/droiddeck/launcher/frontend/SoundtrackCollections.kt +++ b/app/src/main/java/com/droiddeck/launcher/frontend/SoundtrackCollections.kt @@ -177,9 +177,10 @@ object SoundtrackCollections { source = Library.SOURCE_COLLECTION, soundtrack = true, ) - fun games(context: Context, favoritesLabel: String): List { + fun games(context: Context, favoritesLabel: String, skipEmptyFavorites: Boolean = false): List { val s = snapshot - return listOf(game(context, FAVORITES_ID, favoritesLabel, s.favorites)) + s.collections.map { game(context, it.id, it.name, it.tracks) } + val favorites = if (skipEmptyFavorites && s.favorites.isEmpty()) emptyList() else listOf(game(context, FAVORITES_ID, favoritesLabel, s.favorites)) + return favorites + s.collections.map { game(context, it.id, it.name, it.tracks) } } fun album(context: Context, id: Int): Soundtrack.Album { diff --git a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt index 3a96df2f4b..3c26a37558 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt @@ -258,7 +258,7 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String, val favoritesLabel = stringResource(R.string.soundtracks_favorites) val all = remember(soundMode, s.steamGames, s.soundtracks, s.soundtracksEnabled, cloudRows, owned, installedStore, savedSnapshot, favoritesLabel) { if (soundMode) s.soundtracks.map { LibraryEntry("sound:${it.appId}", it.source, it.name, it, null, true) } + - (if (s.soundtracks.isEmpty() && savedSnapshot.favorites.isEmpty() && savedSnapshot.collections.isEmpty()) emptyList() else SoundtrackCollections.games(ctx, favoritesLabel)) + (if (s.soundtracks.isEmpty() && savedSnapshot.favorites.isEmpty() && savedSnapshot.collections.isEmpty()) emptyList() else SoundtrackCollections.games(ctx, favoritesLabel, skipEmptyFavorites = true)) .map { LibraryEntry("sound:${it.appId}", it.source, it.name, it, null, true) } else libraryEntries(s.steamGames + cloudRows + if (s.soundtracksEnabled) emptyList() else s.soundtracks.filter { it.library != Library.ADDED }, owned, installedStore) } diff --git a/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt b/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt index 6aa9bb1640..8ae6166895 100644 --- a/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt @@ -40,4 +40,15 @@ class SoundtrackCollectionsTest { val list = listOf(Collection(2_000_000_005, "x", emptyList())) assertEquals(2_000_000_006, SoundtrackCollections.nextId(list)) } + + @Test fun emptyFavoritesCanBeLeftOutOfTheLibraryList() { + val context = androidx.test.core.app.ApplicationProvider.getApplicationContext() + SoundtrackCollections.load(context) + SoundtrackCollections.create(context, "Chill", emptyList()) + val ids = { skip: Boolean -> SoundtrackCollections.games(context, "Favorites", skip).map { it.appId } } + assertTrue(SoundtrackCollections.FAVORITES_ID in ids(false)) + assertFalse(SoundtrackCollections.FAVORITES_ID in ids(true)) + SoundtrackCollections.add(context, SoundtrackCollections.FAVORITES_ID, listOf(ref("a"))) + assertTrue(SoundtrackCollections.FAVORITES_ID in ids(true)) + } } From b74d005e7f2ebd4eee5bdffca3664ea59febf2da Mon Sep 17 00:00:00 2001 From: FX192 <120828496+FX192@users.noreply.github.com> Date: Wed, 18 Nov 2026 18:43:26 +0300 Subject: [PATCH 2/2] fix(library): only list the Collections source when it has something to show --- .../java/com/droiddeck/launcher/ui/LibraryPage.kt | 2 +- .../launcher/frontend/SoundtrackCollectionsTest.kt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt index 3c26a37558..a90aa79ca8 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/LibraryPage.kt @@ -282,7 +282,7 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String, val gameJoltSignedIn = owned.containsKey(Store.GAMEJOLT) val sources = librarySources( all, SessionPrefs.storesTabOrder(ctx), - listOfNotNull(Store.ITCH.id.takeIf { itchSignedIn && !soundMode }, Store.GAMEJOLT.id.takeIf { gameJoltSignedIn && !soundMode }, Library.SOURCE_COLLECTION.takeIf { soundMode }).toSet(), + listOfNotNull(Store.ITCH.id.takeIf { itchSignedIn && !soundMode }, Store.GAMEJOLT.id.takeIf { gameJoltSignedIn && !soundMode }).toSet(), favorites, concealed, LibraryDisplay.hidden && !soundMode, ) val source = LibraryView.source.takeIf { it == LIBRARY_ALL || it in sources } ?: LIBRARY_ALL diff --git a/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt b/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt index 8ae6166895..3d85fc18ff 100644 --- a/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/frontend/SoundtrackCollectionsTest.kt @@ -44,11 +44,11 @@ class SoundtrackCollectionsTest { @Test fun emptyFavoritesCanBeLeftOutOfTheLibraryList() { val context = androidx.test.core.app.ApplicationProvider.getApplicationContext() SoundtrackCollections.load(context) - SoundtrackCollections.create(context, "Chill", emptyList()) - val ids = { skip: Boolean -> SoundtrackCollections.games(context, "Favorites", skip).map { it.appId } } - assertTrue(SoundtrackCollections.FAVORITES_ID in ids(false)) - assertFalse(SoundtrackCollections.FAVORITES_ID in ids(true)) - SoundtrackCollections.add(context, SoundtrackCollections.FAVORITES_ID, listOf(ref("a"))) - assertTrue(SoundtrackCollections.FAVORITES_ID in ids(true)) + val custom = SoundtrackCollections.create(context, "Chill", emptyList())!! + val favorites = SoundtrackCollections.FAVORITES_ID + assertEquals(listOf(custom), SoundtrackCollections.games(context, "Favorites", skipEmptyFavorites = true).map { it.appId }) + assertEquals(listOf(favorites, custom), SoundtrackCollections.games(context, "Favorites").map { it.appId }) + SoundtrackCollections.add(context, favorites, listOf(ref("a"))) + assertEquals(listOf(favorites, custom), SoundtrackCollections.games(context, "Favorites", skipEmptyFavorites = true).map { it.appId }) } }