Custom Snooze#515
Open
JonathanKChang wants to merge 8 commits into
Open
Conversation
- Add a new toggle in General > Interactions settings to enable/disable custom snooze duration for alarms and timers. - Add 'Enable Custom Snooze' and 'Custom Snooze...' labels for the new custom snooze feature in alarm and timer notification screens.
Add _snoozeDuration field and update snooze() to accept optional minutes or seconds parameters. Uses custom duration when provided, falls back to configured snoozeLength otherwise.
Update snooze() to accept an optional TimeDuration parameter. When provided, uses the custom duration instead of the default addLength.
…tion layer Update stopAlarm(), dismissAlarmNotification(), and snoozeAlarm() to accept and forward optional snoozeSeconds through the isolate message channel.
Parse optional snoozeSeconds from isolate message and pass to stopAlarm/stopTimer. Use custom duration when provided, otherwise fall back to configured snoozeLength for alarms or default snooze for timers.
Add a 'Custom Snooze...' button to both alarm and timer notification screens when the feature is enabled. Opens the duration picker and passes the selected duration through to the snooze action.
Add snapLength: 1 to the snooze Length setting so the preset snooze duration only accepts whole minutes. Custom snooze via the duration picker is unaffected and still allows sub-minute values.
…ogic When custom snooze is set to 0, convert the action to dismiss instead of entering the snooze code path. This ensures alarms marked for "Delete After Dismissed" are properly removed when a 0-second snooze is selected.
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.
Summary
Implements custom snooze duration selection via a new UI action on active alarm and timer notifications, gated behind an opt-in settings toggle ("General > Interactions > Enable Custom Snooze"). Addresses issues #364 and to some extent #480, #509.
Changes
snooze()accept custom durations —Alarm.snooze()now takes optionalminutesorsecondsparams;ClockTimer.snooze()takes an optionalTimeDuration. Falls back to existing configured length when no duration is provided.stopScheduledNotificationin the alarm isolate extracts a new optional 4th field (snoozeSeconds) from the inter-isolate message and passes it through to bothstopAlarmandstopTimer.alarm_notification_screen.dartandtimer_notification_screen.dartshow a "Custom Snooze..." TextButton below the action widget. Tapping launches ashowDurationPicker, then dismisses the notification viadismissAlarmNotification(..., snoozeSeconds: duration.inSeconds).general_settings_schema.dartadds a SwitchSetting at"General" > "Interactions" > "Enable Custom Snooze", defaulting tofalse. Only alarms wherealarm.canBeSnoozedshows the button (alarms are checked; timers show it unconditionally when the setting is on).enableCustomSnoozeSettingandcustomSnoozeButtonkeys toapp_en.arb._snoozeDurationfield onAlarm(plus copy/assign propagation) records each snooze's actual duration.snapLength: 1to the snooze length setting inalarm_settings_schema.dart.Notes
Design Decisions
showDurationPickercomponent already in the codebase. This avoids duplicating picker UI, reduces decision fatigue, and supports any duration—not just a predefined set.Implementation Details
false, so existing users won't see the button until they enable it. No migration needed.Alarm.snooze(seconds:). Timer snooze withTimeDurationalso supports sub-minute granularity.snapLength: 1on snooze setting — changing the flow to accept sub-minute amounts has made this slider allow you to select fractional minutes, which I think would confuse users, so I snapped it to minutes.