chrono
chrono copied to clipboard
One Shot Timers
Summary
Add a “Delete After Finishing” option for timers that removes one‑shot timers from storage automatically when they are dismissed. Addresses #433
Changes
- Alarm isolate
- After stopping a timer, if
timer.shouldDeleteAfterFinishingis true:- Load the persisted timer list, remove the finished timer, and save the updated list.
- Notify the UI isolate via
updatePort(updateTimersmessage) to refresh the timer list.
- After stopping a timer, if
- Localization
- Added
timerDeleteAfterFinishingSettingstring toapp_en.arb.
- Added
- Settings schema
- Introduced a new
SwitchSettingnamed “Delete After Finishing” (defaultfalse) intimerSettingsSchema.
- Introduced a new
- Timer model
- Exposed
shouldDeleteAfterFinishinggetter that reads the new setting.
- Exposed
- Timer card UI
- Shows a small trash-can icon next to timers that have the one‑shot flag enabled.
Notes
- Implementation details:
- Deletion happens in the background isolate that controls timer lifecycles, ensuring the UI does not need to manage the removal directly.
- The UI receives a simple
"updateTimers"message; existing UI code already handles generic timer‑list refreshes.