chrono icon indicating copy to clipboard operation
chrono copied to clipboard

Custom Snooze

Open JonathanKChang opened this issue 6 months ago • 0 comments

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 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 extended — stopScheduledNotification 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 toggle — general_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 #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 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

JonathanKChang avatar May 27 '26 04:05 JonathanKChang