Skip to content

Make +/- button step configurable#7

Merged
Xitee1 merged 2 commits into
mainfrom
feat/configurable-step-minutes
Apr 18, 2026
Merged

Make +/- button step configurable#7
Xitee1 merged 2 commits into
mainfrom
feat/configurable-step-minutes

Conversation

@Xitee1
Copy link
Copy Markdown
Owner

@Xitee1 Xitee1 commented Apr 18, 2026

Summary

  • New +/− step setting (1–30 min, default 5) exposed as a slider in the Sleep Timer settings section, styled like the existing fade-out slider.
  • SleepTimerService observes UserSettings.stepMinutes and uses it for add/subtract while a timer is running; both notification action labels reflect the current value (e.g. +10 min / -10 min) and update live if the setting changes mid-timer.
  • Idle-mode +/− snaps to the nearest lower/higher multiple of the step — e.g. with step 5, 9 → 5 on minus and 9 → 10 on plus (previously 9 → 0 on minus, and 14 → 5 on minus).
  • Renamed the internal actions ACTION_ADD_FIVE / ACTION_SUBTRACT_FIVEACTION_ADD_MINUTES / ACTION_SUBTRACT_MINUTES and the ViewModel methods to addStep / subtractStep.

Test plan

  • Open Settings → Sleep Timer → slide +/− step to 10 min; back on the timer, + adds 10 and subtracts 10.
  • Set step to 1 min; + / change the dial by 1 minute each press.
  • Idle, set dial to 9 min with step 5 → goes to 5, + goes to 10.
  • Idle, set dial to 14 min with step 5 → goes to 10, + goes to 15.
  • Start a 20 min timer with step 5, change step to 10 in settings without cancelling → notification labels show +10 min / -10 min, tapping adds/subtracts 10.
  • Running timer, step 10, ≤ 10 min remaining → minus button disabled.
  • Fresh install: default step is 5 min.

🤖 Generated with Claude Code

Xitee1 and others added 2 commits April 18, 2026 11:22
Replace the hardcoded 5-minute increment with a user-configurable step
(1-30 min, default 5) exposed via a new slider in Settings.
SleepTimerService observes the setting, so notification actions and
in-app +/- buttons both honor changes even mid-timer. The notification
labels update dynamically (e.g. "+10 min" / "-10 min").

Idle-mode +/- now snaps to the nearest lower/higher multiple of the
step regardless of the starting value, fixing the case where e.g. 9
with step 5 would jump straight to 0 on minus (now correctly goes to
5).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Without this, the service's local stepMinutes held a hardcoded 5 until
the onCreate flow-collect coroutine received its first DataStore
emission — but onStartCommand ran startTimer() synchronously between
those two moments, so the first notification was built with +5/-5
labels even when the user had configured a different value. Load the
value synchronously in onCreate so the service is a pure reader of the
setting; UserSettings remains the sole source of the default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Xitee1 Xitee1 merged commit 3fdc59f into main Apr 18, 2026
1 check passed
@Xitee1 Xitee1 deleted the feat/configurable-step-minutes branch April 18, 2026 09:32
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