Implement challenge filtering by content categories #2157
+147
−26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.