Device: Add Press Controls screen to customise press behaviour#523
Merged
Conversation
…ls screen Move press timing, call controls, and stem mappings out of the Controls card into a new Press Controls screen. The screen name is device-agnostic so it applies to both stemmed AirPods and the AirPods Max's Digital Crown/noise button. Stem mappings are now per-device (stored on the AppleDeviceProfile) rather than a single app-global DataStore. The Pro gate for mappings moves from screen entry to per-change with an Upgrade badge on the mappings card header, so free users can still access the non-Pro press timing and call-control settings that live on the same screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed
A new Press Controls screen under Device Settings consolidates every press-related setting into one place: press speed, press & hold duration, call-button mapping, and (for stemmed AirPods) custom single / double / triple / long press actions. Previously these were scattered across the Controls card and a separate "Stem Actions" screen.
Stem action mappings are now per-device. If you own more than one pair of AirPods you can set different mappings on each one.
A Pro badge appears on the Press Mappings section header so you can see upfront that assigning custom actions requires an upgrade, rather than finding out only after tapping a dropdown.
The screen name was chosen to fit both stemmed AirPods and the AirPods Max (Digital Crown / noise control button).
Technical Context
DataStore(StemActionSettings) onto a newstemActions: StemActionsConfigfield onAppleDeviceProfile. No migration path — feature was beta / unreleased, so accepting the data loss was simpler than per-profile bootstrapping. Beta users with custom mappings will see them reset on update.navToPressControls()) to per-mapping setter. Each setter checks, in order: (1) no-op short-circuit ifaction == current, (2) free-clear allowance ifaction == NONE, (3) Pro check — otherwise navigate to Upgrade. Rule (2) prevents lapsed-Pro users from being trapped with old mappings.StemPressReactionnow resolves the event address to a profile before looking up the mapped action.StemConfigSendercomputes a per-profile mask instead of broadcasting one shared mask, so a device with no custom mappings gets0x00and won't intercept presses at all.StemActionenum and the AAP protocol classes (StemPressEvent,StemPressReaction,StemConfigSender) keep their names intentionally — they describe Apple's on-wire protocol, not the UI.PressMappingsCardwas extracted into its own file so it has self-contained Compose previews for Pro and non-Pro states; the screen itself also has Pro / non-Pro / press-only-device previews.data object StemActionConfigtodata class PressControls(profileId)— saved back-stack state from before the change won't deserialise cleanly, which is acceptable since the screen was beta.Review checklist
hasStemConfig) shows the nav link and opens the screen with timing / call sections only — no mapping rows, no reset button, no ANC info box