Skip to content

Implement challenge filtering by content categories #2157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Hafizzle
Copy link
Contributor

  • Persisted the backend's CategoryOption objects in Realm by annotating key with @PrimaryKey and calling realm.insertOrUpdate(contentResult.categoryOptions) in the content save routine.

  • Extended the Challenge model to include a new ChallengeCategory RealmObject (fields id, slug, name) and a RealmList named categories, and updated the ChallengeDeserializer to parse the JSON categories array into that list.

  • Bridged each CategoryOption into an unmanaged Group for the filter dialog via CategoryOption.toFilterGroup() (setting group.id = key and human-casing the server‐provided label), plus fun List.toFilterGroups() to map the full list.

  • Added fun setCategoryOptions(keys: List) to ChallengesListViewAdapter to supply the adapter with the full set of valid category slugs before filtering.

  • In ChallengeListFragment, collected the getCategoryOptions() Flow into categoryOptions, invoked adapter.setCategoryOptions(categoryOptions.map { it.key }), and merged the resulting "category" Groups with social groups (Tavern/Guild) before calling ChallengeFilterDialogHolder.showDialog().

  • Rewrote the adapter's filter() method to split the checked Group.id values into real group UUIDs (filtering on groupId) versus content‐category slugs (filtering on categories.slug), applied both in the same Realm query, and kept the existing owned / not-owned logic so that selecting any checkbox immediately narrows the displayed challenges exactly like on web.

  • Added the “Category” header above the RecyclerView in dialog_challenge_filter.xml, using the @style/Caption3 TextView and a new @string/category resource.

  • Added ChallengeCategory RealmObject class with id, slug, and name fields

  • Added var categories: RealmList to the Challenge model

  • Created fun CategoryOption.toFilterGroup() and fun List.toFilterGroups() extension functions to bridge to Group instances

  • Added fun getCategoryOptions(): Flow<List> to the ChallengeLocalRepository interface and implemented it in RealmChallengeLocalRepository to stream the persisted categoryOptions.

- Persisted the backend's CategoryOption objects in Realm by annotating key with @PrimaryKey and calling realm.insertOrUpdate(contentResult.categoryOptions) in the content save routine.

- Extended the Challenge model to include a new ChallengeCategory RealmObject (fields id, slug, name) and a RealmList<ChallengeCategory> named categories, and updated the ChallengeDeserializer to parse the JSON categories array into that list.

- Bridged each CategoryOption into an unmanaged Group for the filter dialog via CategoryOption.toFilterGroup() (setting group.id = key and human-casing the server‐provided label), plus fun List<CategoryOption>.toFilterGroups() to map the full list.

- Added fun setCategoryOptions(keys: List<String>) to ChallengesListViewAdapter to supply the adapter with the full set of valid category slugs before filtering.

- In ChallengeListFragment, collected the getCategoryOptions() Flow into categoryOptions, invoked adapter.setCategoryOptions(categoryOptions.map { it.key }), and merged the resulting "category" Groups with social groups (Tavern/Guild) before calling ChallengeFilterDialogHolder.showDialog().

- Rewrote the adapter's filter() method to split the checked Group.id values into real group UUIDs (filtering on groupId) versus content‐category slugs (filtering on categories.slug), applied both in the same Realm query, and kept the existing owned / not-owned logic so that selecting any checkbox immediately narrows the displayed challenges exactly like on web.

- Added the “Category” header above the RecyclerView in dialog_challenge_filter.xml, using the @style/Caption3 TextView and a new @string/category resource.

- Added ChallengeCategory RealmObject class with id, slug, and name fields

- Added var categories: RealmList<ChallengeCategory> to the Challenge model

- Created fun CategoryOption.toFilterGroup() and fun List<CategoryOption>.toFilterGroups() extension functions to bridge to Group instances

- Added fun getCategoryOptions(): Flow<List<CategoryOption>> to the ChallengeLocalRepository interface and implemented it in RealmChallengeLocalRepository to stream the persisted categoryOptions.
@Hafizzle Hafizzle linked an issue Jun 20, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Challenges: Filtering in 'Discover' doesn't work as intended
1 participant