Skip to content

Custom Snooze#515

Open
JonathanKChang wants to merge 8 commits into
vicolo-dev:masterfrom
JonathanKChang:feature/custom-snooze
Open

Custom Snooze#515
JonathanKChang wants to merge 8 commits into
vicolo-dev:masterfrom
JonathanKChang:feature/custom-snooze

Conversation

@JonathanKChang
Copy link
Copy Markdown

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

  • Alarm & Timer snooze() accept custom durationsAlarm.snooze() now takes optional minutes or seconds params; ClockTimer.snooze() takes an optional TimeDuration. Falls back to existing configured length when no duration is provided.
  • Isolate message layer extendedstopScheduledNotification in the alarm isolate extracts a new optional 4th field (snoozeSeconds) from the inter-isolate message and passes it through to both stopAlarm and stopTimer.
  • UI: Custom Snooze button — Both alarm_notification_screen.dart and timer_notification_screen.dart show a "Custom Snooze..." TextButton below the action widget. Tapping launches a showDurationPicker, then dismisses the notification via dismissAlarmNotification(..., snoozeSeconds: duration.inSeconds).
  • New settings togglegeneral_settings_schema.dart adds a SwitchSetting at "General" > "Interactions" > "Enable Custom Snooze", defaulting to false. Only alarms where alarm.canBeSnoozed shows the button (alarms are checked; timers show it unconditionally when the setting is on).
  • Localization — Adds enableCustomSnoozeSetting and customSnoozeButton keys to app_en.arb.
  • Alarm state tracking — New _snoozeDuration field on Alarm (plus copy/assign propagation) records each snooze's actual duration.
  • Minor fix in schema — Adds snapLength: 1 to the snooze length setting in alarm_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 showDurationPicker component 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 [Request] Multiple Snooze Durations #480 and Feature: Dynamic Snooze Duration #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 with TimeDuration also supports sub-minute granularity.
  • snapLength: 1 on 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.
Screenshot_20260524-144507 Screenshot_20260524-150602

- 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.
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