Skip to content

Conversation

@ooii
Copy link

@ooii ooii commented Jan 18, 2026

Need

Some users prefer not to have haptic feedback (vibrations) when using the app, either due to personal preference or accessibility reasons. Currently, there is no way to disable haptic feedback in the app settings.

Solution

Added a new preference toggle that allows users to enable/disable haptic feedback throughout the app.

Implementation Details

  1. New preference key in Keys+Entries.swift:

    static let enableHaptics = Key("enableHaptics", default: true)
  2. New View extension (View+SensoryFeedback.swift):

    • Created a hapticFeedback(_:trigger:) modifier that wraps SwiftUI's sensoryFeedback
    • Uses a ConditionalSensoryFeedbackModifier that checks the preference before applying feedback
    • Only triggers haptic feedback when the preference is enabled
  3. New preference toggle (HapticsPreference.swift):

    • Reusable toggle component following the existing preference pattern
    • Added to the Preferences view
  4. Migration of existing code:

    • Replaced all 28 occurrences of .sensoryFeedback() with .hapticFeedback() across 21 files
    • This ensures all haptic feedback in the app respects the user preference
  5. Localization:

    • Added translations for "Haptic feedback" in all supported languages (EN, FR, DE, RU, SV, UK, ZH-Hans)

Files Changed

  • ShelfPlayerKit/Extensions/Keys+Entries.swift - New preference key
  • Multiplatform/Extensions/SwiftUI/View+SensoryFeedback.swift - New (conditional modifier)
  • Multiplatform/Preferences/HapticsPreference.swift - New (toggle component)
  • Multiplatform/Preferences/PreferencesView.swift - Added toggle to UI
  • Multiplatform/Localizable.xcstrings - Translations
  • 21 view files - Replaced .sensoryFeedback() with .hapticFeedback()

Test Plan

  • Toggle is visible in Preferences
  • When enabled (default): haptic feedback works as before
  • When disabled: no haptic feedback anywhere in the app
  • Preference persists across app restarts

🤖 Generated with Claude Code

Implement a toggle in Settings to allow users to disable haptic feedback
throughout the app. Previously, haptic feedback was always enabled with
no way to turn it off.

Changes:
- Add 'enableHaptics' preference key (defaults to true)
- Create View+SensoryFeedback.swift with conditional hapticFeedback()
  modifier that wraps SwiftUI's sensoryFeedback() and respects the
  user preference
- Add HapticsPreference.swift toggle component for the settings UI
- Add toggle to PreferencesView in the appearance section
- Replace all 28 occurrences of .sensoryFeedback() with .hapticFeedback()
  across 21 view files
- Add localized strings for "Haptic feedback" in all supported languages:
  EN, FR, DE, RU, SV, UK, ZH-Hans

When disabled, the hapticFeedback() modifier simply returns the content
unchanged, preventing any vibration feedback.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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