mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
feat(itch): collections filter in the Library (#1597)
* Add itch.io collections to the Library A Collections button on the Library's itch tab filters the library to one collection of the signed-in account. Its games that are not installed show in the Not installed section. * Keep itch collections complete across failures, sign-out and empty libraries A failed later page no longer publishes a partial collection, selecting a collection refreshes it, pagination runs until an empty page, signing out clears collection state, and the itch chip shows for a signed-in account with no owned games. * Tie itch collection requests to the account that started them Requests capture the account generation before reading the key and dedupe per generation, sign-out clears collections after the token is removed, and the collections load follows the itch sign-in state. * Keep paging itch collections past a page of already seen games * Run the itch collections tests under Robolectric like the other itch tests * Let the Installed filter apply inside a collection and keep the grid for an empty itch account * fix(itch): stop paging a collection when a page adds no new games * Keep the collections icon on the itch collections tab when it opens --------- Co-authored-by: maxjivi05 <maxjividen@gmail.com>
This commit is contained in:
1 parent
f13916ee25
commit
d905f03bf7
41 files changed
+313
-12
No files matched your search
@@ -94,4 +94,23 @@ class LibraryEntriesTest {
|
||||
GameRef.parse("xbox:9NBLGGH4R315").let { assertEquals(Store.XBOX, it.store); assertEquals("9NBLGGH4R315", it.storeId) }
|
||||
GameRef.parse("app:nope:1").let { assertNull(it.store); assertNull(it.appId) }
|
||||
}
|
||||
|
||||
@Test fun aCollectionKeepsItsInstalledGamesAndListsTheRestAsNotInstalled() {
|
||||
val games = listOf(
|
||||
Library.SteamGame(440, "Team Fortress 2", null, "Steam library"),
|
||||
Library.SteamGame(-5, "Celeste", null, Library.ADDED, source = "itch", storeId = "a/celeste"),
|
||||
Library.SteamGame(-6, "Other", null, Library.ADDED, source = "itch", storeId = "a/other"),
|
||||
)
|
||||
val library = mapOf(Store.ITCH to listOf(owned(Store.ITCH, "a/celeste"), owned(Store.ITCH, "a/other"), owned(Store.ITCH, "b/owned")))
|
||||
val all = libraryEntries(games, library, setOf("itch:a/celeste", "itch:a/other"))
|
||||
val collection = listOf(owned(Store.ITCH, "a/celeste"), owned(Store.ITCH, "b/owned"), owned(Store.ITCH, "c/new"))
|
||||
val out = collectionEntries(all, collection)
|
||||
assertEquals(listOf("app:-5", "app:itch:b/owned", "app:itch:c/new"), out.map { it.key })
|
||||
assertEquals(listOf(true, false, false), out.map { it.installed })
|
||||
}
|
||||
|
||||
@Test fun anEmptyCollectionHidesEveryGame() {
|
||||
val all = libraryEntries(listOf(Library.SteamGame(440, "Team Fortress 2", null, "Steam library")), emptyMap(), emptySet())
|
||||
assertEquals(emptyList<String>(), collectionEntries(all, emptyList()).map { it.key })
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user