chrono
chrono copied to clipboard
Custom Snooze
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, #486
Changes
- Alarm & Timer
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. - Isolate message layer extended —
stopScheduledNotificationin the alarm isolate extracts a new optional 4th field (snoozeSeconds) from the inter-isolate message and passes it through to bothstopAlarmandstopTimer. - UI: Custom Snooze button — Both
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). - New settings toggle —
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). - Localization — Adds
enableCustomSnoozeSettingandcustomSnoozeButtonkeys toapp_en.arb. - Alarm state tracking — New
_snoozeDurationfield onAlarm(plus copy/assign propagation) records each snooze's actual duration. - Minor fix in schema — Adds
snapLength: 1to the snooze length setting inalarm_settings_schema.dart.
Notes
Design Decisions
- Unobtrusive visual presence — The custom-snooze button is a text-style (unfilled) TextButton, keeping it visually subordinate to primary actions. It requires the user to open the ringing notification before they can snooze with a custom duration.
- Duration picker over pre-set list — Rather than exposing multiple fixed options (e.g. 5/10/15 min), this re-uses the existing
showDurationPickercomponent already in the codebase. This avoids duplicating picker UI, reduces decision fatigue, and supports any duration—not just a predefined set. - Minimal surface area — Only one action button is shown on the notification screen; no fly-out menus, dialogs, or additional screens are introduced at snooze time.
- Why #480 and #509 are not fully addressed — Those issues requested per-alarm pre-set duration lists and +/- step adjustment at snooze time (e.g. Samsung-style ±5 min). The duration picker approach was chosen deliberately to keep the notification screen minimal, avoid duplicating picker UI, and let users pick any duration without navigating menus. This means the app does not currently support multiple snooze presets per-alarm or quick +/- adjustments. I do have some branches where I have put in a similar custom snooze kind of button on the timer screen where you can play/pause, +1:00 (or whatever you set), and restart. That button just temporarily overrides the current timer (so you can basically reduce or increase it arbitrarily), without affecting the base time duration. This goes well with the repeat feature I have on one of my branches.
Implementation Details
- Opt-in by default — The feature is behind a toggle defaulting to
false, so existing users won't see the button until they enable it. No migration needed. - Sub-minute precision — Snooze durations are passed as total seconds (not rounded to minutes) through the isolate and into
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.