Add snooze with bluetooth play-pause control #488
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.
Add Bluetooth/CarPlay Play-Pause Button Snooze Support
Summary
This PR adds the ability to snooze active alarms using the play/pause button on Bluetooth headphones, speakers, and CarPlay interfaces. This provides a convenient hands-free way to snooze alarms, especially useful while driving or when the phone is not easily accessible.
What's New
Technical Changes
VolumeButtonHandler.swift
Added MPRemoteCommandCenter integration to handle media control commands
Implemented handlers for three command types:
Added setupRemoteCommandCenter() to configure command handlers when monitoring starts
Added disableRemoteCommandCenter() to properly clean up when monitoring stops
All commands respect the same activation delay and cooldown period as volume button snoozing
Added comprehensive logging for debugging Bluetooth interactions
Simplified audio session configuration by removing deprecated API usage
Replaced convertFromAVAudioSessionCategory() calls with modern .playback category syntax
Removed .mixWithOthers option to ensure alarms have full audio control
Added logging for audio session configuration
Behavior
Remote commands follow the same timing rules as volume buttons:
Activation delay after alarm starts (prevents accidental snoozes)
Cooldown period between presses (prevents multiple rapid snoozes)
Works with any Bluetooth audio device that sends media control commands
Audio route information is logged to help with debugging connectivity issues