Files
DroidDeck/docs/development/itch-collections.md
FX1922andmaxjivi05 d905f03bf7 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>
2026-10-26 18:15:24 -04:00

27 lines
1.3 KiB
Markdown

# itch.io collections
On the Library's itch tab a Collections button in the header lists the collections of the signed-in
itch account. Picking one hides every game that is not in it; the games of the collection that are not
installed show in the existing "Not installed" section, and All brings the full library back. The button
exists only while the itch chip is selected.
## Data
`ItchCollections` (`stores/itch/ItchCollections.kt`) asks itch with the account's API key:
```
GET /profile/collections -> collections[{id, title, games_count}]
GET /collections/<id>/collection-games?page=N -> collection_games[{game{...}}]
```
Pages are read until one comes back empty. Each game goes through `ItchLibrary.item`, the reader the
library and shelves share, so it looks the same everywhere. The selection and the loaded games live in
memory; the list is asked again whenever the itch tab opens. Counts are logged
(`itch.io: <n> collections`, `itch.io: collection <id> has <n> games`).
## Filtering
`collectionEntries` keeps the itch entries whose store key is in the collection, then adds the
collection games the library has no entry for as not installed ones. Their game page resolves through
`StoresState.detailItem`, which also looks at the collection games.