Skip to content

feat(mobile): add Haptic feedback preference - #45

Closed
iscekic wants to merge 1 commit into
mainfrom
kwf/in-the-mobile-app-preference-c697
Closed

iscekic wants to merge 1 commit into
mainfrom
kwf/in-the-mobile-app-preference-c697

Conversation

@iscekic

@iscekic iscekic commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Request

In the mobile app preferences screen, add a 'Haptic feedback' section with three options: Off, Light, and Full. The selected option persists across app launches and takes effect immediately when tapped.

Changelog for users

  • The Preferences screen shows a new "Haptic feedback" section with three options: Off, Light, and Full.
  • Tapping an option applies it immediately. Off stops haptic feedback, Light softens it, and Full keeps full feedback.
  • The selected option persists across app launches and restores when the app reopens.

Changelog for maintainers

  • Added a @/lib/haptics gate. All haptic call sites now import it instead of expo-haptics, and the gate reads a module-scope strength on every call.
  • Off turns selection, impact, and notification calls into no-ops. Light caps impacts at the softest tick and downgrades notification buzzes to a selection tick. Full forwards every call unchanged.
  • Added @/lib/hooks/use-haptic-preference, a SecureStore preference under key haptic-strength with default full. preloadHapticPreference() runs in the root layout at app start and mirrors the stored value into the gate.
  • Added hapticFeedback, hapticFull, and hapticLight to every locale catalog. hapticLight is a screen-reader label that interpolates two other keys and is now in the English-identical allowlist.
  • SegmentedControl now accepts a per-option accessibilityLabel. The haptic Light option uses it to disambiguate from the Appearance Light radio for screen readers.
  • Added unit and mounted tests for the gate, the hook store-and-gate mirror, the segmented-control labels, and the preferences screen. The hook test covers the save-failure toast path.
  • Review risk: the gate holds module-scope state, and the hook arms its mirror subscription only once. Check that the load-once flag stays correct across re-mounts.

E2E proof

[e1] Preferences shows the Haptic feedback section with Off, Light, Full; tapping options updates the selection immediately: section visible, Off/Light/Full selectable in one flow — e2e-mobile-app/e1-off.png

[e1] Preferences shows the Haptic feedback section with Off, Light, Full; tapping options updates the selection immediately: section visible, Off/Light/Full selectable in one flow — e2e-mobile-app/e1-haptic-light.png

[e2] Selected haptic option persists when leaving and re-entering Preferences: Light stays selected after navigating away and back — e2e-mobile-app/e2-haptic-light-persisted.png

[e3] needs:fault: haptic preference disk-write rejection shows the 'Could not save setting' toast and keeps the in-session selection (harness cannot fault SecureStore; proven by use-haptic-preference.test.ts) — e2e-mobile-app/e3-prefs.png

[e3] needs:fault: haptic preference disk-write rejection shows the 'Could not save setting' toast and keeps the in-session selection (harness cannot fault SecureStore; proven by use-haptic-preference.test.ts) — e2e-mobile-app/e3-toast.png

[e5] ux-check: Tapping a different option immediately moves the highlight and changes feedback strength: Off gives no tick, Light gives a soft tick, Full gives a full tick on the next interaction — e2e-mobile-app/e5-haptic-off.png

Follow-ups (not changed here)

  • Preferences — tab bar covers the Language row (e4.png).
  • not proved live: Android: the VM proof section did not launch; proved on iOS only

In the mobile app preferences screen, add a 'Haptic feedback' section with three options: Off, Light, and Full. The selected option persists across app launches and takes effect immediately when tapped.
@iscekic iscekic closed this Sep 6, 2026
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.

1 participant