Skip to content

feat: suppress connection alerts for bodyweight-only workouts (#693) - #694

Merged
9thLevelSoftware merged 1 commit into
mainfrom
feat/693-bodyweight-connection-alert-suppression
Aug 6, 2026
Merged

feat: suppress connection alerts for bodyweight-only workouts (#693)#694
9thLevelSoftware merged 1 commit into
mainfrom
feat/693-bodyweight-connection-alert-suppression

Conversation

@9thLevelSoftware

Copy link
Copy Markdown
Owner

Summary

Suppresses the ConnectionLostDialog and BLE auto-reconnect when the loaded workout routine contains only bodyweight exercises. This prevents spurious interruptions during bodyweight-only sessions (e.g. pull-up EMOM workouts) when the Vitruvian trainer auto-powers-off after 15 minutes of inactivity.

Fixes #693

Changes

Single chokepoint: DefaultWorkoutSessionManager.isWorkoutActiveForConnectionAlert

File Change
DefaultWorkoutSessionManager.kt Modified isWorkoutActiveForConnectionAlert to return false when all routine exercises are bodyweight
BleConnectionManagerTest.kt Extended FakeWorkoutStateProvider with allBodyweight flag; added bodyweight disconnect test
MainViewModelTest.kt Added integration test: bodyweight routine disconnect does not trigger alert

~91 LOC across 3 files. No UI/schema/API/interface changes.

Behavior Matrix

Workout Type Connection Alert on Disconnect
Routine with all bodyweight exercises Suppressed
Routine with mixed cable + bodyweight Alert appears
Routine with all cable exercises Alert appears
Single bodyweight exercise Suppressed
Single cable exercise Alert appears
Just Lift mode Alert appears
Routine not loaded (race) Alert appears (safe fallback)

Test Results

  • BleConnectionManagerTest — all tests pass (including new bodyweight test)
  • MainViewModelTest — all tests pass (including new bodyweight integration test)
  • ✅ Full shared:testAndroidHostTest — regression suite green

Release Note

Enhancement: Suppress connection alerts during bodyweight-only workouts

The Phoenix app no longer shows a "Connection Lost" notification or attempts to auto-reconnect when the Vitruvian trainer disconnects during a bodyweight-only workout. Connection monitoring remains fully active for routines that include any cable-based exercise, Just Lift mode, and single cable exercises.

Modify isWorkoutActiveForConnectionAlert in DefaultWorkoutSessionManager
to return false when all exercises in the loaded routine are bodyweight.
This prevents the ConnectionLostDialog and BLE auto-reconnect from
interrupting bodyweight-only workouts (e.g. pull-up EMOM sessions)
when the Vitruvian trainer auto-powers-off after 15 minutes.

- Single chokepoint: DefaultWorkoutSessionManager.isWorkoutActiveForConnectionAlert
- Null-safe: falls back to full monitoring when routine is not loaded
- BleConnectionManager call sites naturally affected (no changes needed)
- Unit test: BleConnectionManagerTest bodyweight disconnect scenario
- Integration test: MainViewModelTest bodyweight routine disconnect

Closes #693
Copilot AI lite review requested due to automatic review settings August 6, 2026 03:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

get() = when (coordinator._workoutState.value) {
is WorkoutState.Active, is WorkoutState.Countdown, is WorkoutState.Resting -> true
else -> false
get() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: The original isWorkoutActiveForConnectionAlert was a tidy 5-line when expression. This PR turned it into a 22-line novella with an early-return if, two stacked comments, and a when-shaped scar at the bottom. It works — but so does wearing a tuxedo to the gym.

🩹 The Fix: Collapse the state check into a single boolean and let the body be one expression. Roughly:

override val isWorkoutActiveForConnectionAlert: Boolean
    get() {
        val active = coordinator._workoutState.value.let {
            it is WorkoutState.Active || it is WorkoutState.Countdown || it is WorkoutState.Resting
        }
        if (!active) return false
        // Issue #693: trainer not needed for bodyweight-only routines.
        val routine = coordinator._loadedRoutine.value
        return routine == null ||
            routine.exercises.isEmpty() ||
            !routine.exercises.all { it.exercise.isBodyweight }
    }

📏 Severity: suggestion

@9thLevelSoftware
9thLevelSoftware merged commit 7ed8235 into main Aug 6, 2026
10 checks passed
@9thLevelSoftware
9thLevelSoftware deleted the feat/693-bodyweight-connection-alert-suppression branch August 6, 2026 15:22
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.

Suppress device disconnect notifications during bodyweight-only workouts

2 participants