Make +/- button step configurable#7
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SleepTimerServiceobservesUserSettings.stepMinutesand 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.9 → 5on minus and9 → 10on plus (previously9 → 0on minus, and14 → 5on minus).ACTION_ADD_FIVE/ACTION_SUBTRACT_FIVE→ACTION_ADD_MINUTES/ACTION_SUBTRACT_MINUTESand the ViewModel methods toaddStep/subtractStep.Test plan
+adds 10 and−subtracts 10.+/−change the dial by 1 minute each press.−goes to 5,+goes to 10.−goes to 10,+goes to 15.+10 min/-10 min, tapping adds/subtracts 10.🤖 Generated with Claude Code