Add sorting to beta features#5392
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds user-selectable sorting to the Settings → Beta features screen by introducing a sort action in the top app bar and wiring it to an OptionsDialog with “Name (A–Z)” and “Release date (newest first)” options. To enable release-date sorting, each Feature enum entry now includes an addedOn: LocalDate, and new localized strings were added for the sort UI.
Changes:
- Add
SortOrderstate + sorting logic toBetaFeaturesViewModel(name or newest-first byaddedOn, with name tiebreaker). - Add a sort icon to the Beta features top app bar and show an
OptionsDialogto select sorting. - Add
addedOn: LocalDatemetadata to eachFeatureand add localization strings for sort labels and accessibility content description.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/services/utils/src/main/java/au/com/shiftyjelly/pocketcasts/utils/featureflag/Feature.kt | Adds addedOn: LocalDate to feature flags to support release-date sorting. |
| modules/services/localization/src/main/res/values/strings.xml | Adds localized strings for the sort action and the two sort options. |
| modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/viewmodel/BetaFeaturesViewModel.kt | Introduces SortOrder and applies sorting when building the feature list/state. |
| modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/BetaFeaturesFragment.kt | Adds a sort action in the app bar and opens an OptionsDialog to change sort order. |
Comments suppressed due to low confidence (1)
modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/BetaFeaturesFragment.kt:118
- The list is now re-sortable, but the LazyColumn items are emitted via a
forloop withitem { ... }and no stable key. When the sort order changes, Compose may reuse item slots by index, which can mis-associate any remembered per-row state (e.g., pressed/interaction/animation state) with the wrong feature. Useitems(..., key = ...)keyed by the feature flag key to keep rows stable across reordering.
LazyColumn(
contentPadding = PaddingValues(vertical = 16.dp),
) {
for (feature in state.featureFlags) {
item {
SettingRow(
sztomek
left a comment
There was a problem hiding this comment.
This change is welcome indeed! Nice work! 👏
As future improvements, we should also add search by name and change orded (Z->A, date added asc)
It often takes me awhile to find the new beta features as I'm not to sure on the name. This change helps by adding a sort by release date. It will also help us find old feature flags we should remove.
Testing Instructions
Checklist
./gradlew spotlessApplyto automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xmlI have tested any UI changes...