End the exercise after the last exhale, not on the timer - #134
Merged
Conversation
The time limit stopped the exercise in the middle of a step. The exercise could stop during an inhale or during a hold, thus the completion screen appeared while the user still held a full breath. The time limit now only arms the completion. The exercise continues to the end of the first step that leaves the lungs empty: the exhale, or the hold that follows it. The extra time is never more than one inhale, one hold and one exhale (8 s for Awake, 12 s for Square, 19 s for Deep Calm and Pranayama). - The timer fades away at 00:00 instead of staying frozen for the last breath, and it leaves the accessibility tree while it is invisible. - The voice and the vibration no longer cue the step that follows the last exhale, and the completion bell plays after the breath. - `StepMetadata.id` is a union type, thus a wrong step name is now a compilation error. Tests: 6 unit tests for the new step transition, and a Maestro flow that sets the shortest time limit and waits for the exercise to end by itself. Co-Authored-By: Claude Opus 5 <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.
Problem
The time limit stopped the exercise in the middle of a step. The exercise could stop during an inhale or during a hold, thus the "Complete" screen appeared while the user still held a full breath.
Change
The time limit no longer stops the exercise. It only arms the completion. The exercise then continues to the end of the first step that leaves the lungs empty — the exhale, or the hold that follows the exhale. The rule is
getExerciseStepTransitioninexercise-session.ts, a pure function.The extra time is never more than one inhale, one hold and one exhale:
Other effects:
StepMetadata.idis a union type instead ofstring, thus a wrong step name is now a compilation error.