Pause for phone calls, release a forgotten pause, fix second review findings #22

Merged
berkay merged 1 commit from review-fixes-2 into main 2026-11-10 21:07:38 +03:00
Owner

Requested by Berkay · project thread

Fixes from Fable's second review of 0.3.2. No version bump, no release.

Medium

  • Phone calls: the workout pauses when a call rings or is under way and the pause menu opens ("PAUSED · FOR A PHONE CALL"). BagDrill holds no audio focus between callouts (music should keep playing), so Android sends no focus loss for a call; the controller asks the phone's audio mode once a second instead (audio_session, no phone permission). VoIP calls (inCommunication) count too.
  • Audio focus: ducking now uses one focus request held through audio_session, released when speech ends, fails or is stopped. Checked in the flutter_tts 4.2.5 source: the plugin does release focus on done/stop/error, but it builds a new request on every phrase, so a stop racing the next phrase could leave an old request behind (music stays ducked).
  • Forgotten pause: after 20 minutes paused the notification service and CPU wake lock are stopped; resuming starts them again.

Low

  • Keep-alive: stop() racing a start or restart no longer leaves the service running; updates wait while a start is in flight; the user gets a message when the service could not start.
  • Skip round from the pause menu: the bell and the next-round callout come after the 3-2-1.
  • TTS slower than 5 s is "loading", not "missing": no false warning, the voice is used as soon as it is ready.
  • After a long hold-up only the last missed sound plays (rounds, checkpoints and the finish still happen).
  • Weekly goal and greeting refresh every hour, so the week turns over at midnight with the app open.

Play prep

  • Settings: "Open-source licenses" (Flutter's licenses page plus the bundled font OFL texts).
  • README: flutter build appbundle; Gradle TODO replaced.

Tests

114 tests pass (flutter analyze clean). New: DeviceKeepAlive logic via a fake platform, voice setup states, session screen widget tests (call pause menu, service and voice warnings, summary), call pause, pause timeout, catch-up, held skip events, licenses.

Not device-tested: call detection, focus/ducking, pause timeout on a real phone.

🤖 Generated with Claude Code

https://claude.ai/code/session_015s4aKpitsS9iZeAcPRp1Ks

<!-- claude-projects-attribution --> _Requested by **Berkay** · [project thread](https://claude.ai/code/project/chan_01T5Cs4GeJAnhjXKSJKvCDa2?thread=cmsg_01T5Cs4GeJAnhjXKSJKvCDa2BewT5z5boLQvKH4Jo12Xvj)_ Fixes from Fable's second review of 0.3.2. No version bump, no release. ## Medium - **Phone calls**: the workout pauses when a call rings or is under way and the pause menu opens ("PAUSED · FOR A PHONE CALL"). BagDrill holds no audio focus between callouts (music should keep playing), so Android sends no focus loss for a call; the controller asks the phone's audio mode once a second instead (`audio_session`, no phone permission). VoIP calls (inCommunication) count too. - **Audio focus**: ducking now uses one focus request held through `audio_session`, released when speech ends, fails or is stopped. Checked in the `flutter_tts` 4.2.5 source: the plugin does release focus on done/stop/error, but it builds a new request on every phrase, so a stop racing the next phrase could leave an old request behind (music stays ducked). - **Forgotten pause**: after 20 minutes paused the notification service and CPU wake lock are stopped; resuming starts them again. ## Low - Keep-alive: `stop()` racing a start or restart no longer leaves the service running; updates wait while a start is in flight; the user gets a message when the service could not start. - Skip round from the pause menu: the bell and the next-round callout come after the 3-2-1. - TTS slower than 5 s is "loading", not "missing": no false warning, the voice is used as soon as it is ready. - After a long hold-up only the last missed sound plays (rounds, checkpoints and the finish still happen). - Weekly goal and greeting refresh every hour, so the week turns over at midnight with the app open. ## Play prep - Settings: "Open-source licenses" (Flutter's licenses page plus the bundled font OFL texts). - README: `flutter build appbundle`; Gradle TODO replaced. ## Tests 114 tests pass (`flutter analyze` clean). New: `DeviceKeepAlive` logic via a fake platform, voice setup states, session screen widget tests (call pause menu, service and voice warnings, summary), call pause, pause timeout, catch-up, held skip events, licenses. Not device-tested: call detection, focus/ducking, pause timeout on a real phone. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015s4aKpitsS9iZeAcPRp1Ks
- Pause the workout when a call rings or is under way (phone audio mode via
  audio_session, no phone permission) and open the pause menu.
- Hold one audio focus request ourselves for ducking (audio_session) instead
  of the TTS plugin's per-phrase request.
- After 20 minutes paused, stop the notification service and wake lock;
  resuming starts them again.
- Keep-alive: no service left running when stop() races a start or restart;
  no second start while one is in flight; tell the user when the service
  could not start. Platform calls behind KeepAlivePlatform for tests.
- Skip round from the pause menu: bell and next-round callout come after
  the 3-2-1, not before.
- A slow TTS engine is "loading", not "missing": no false warning, and the
  voice is used once it is ready.
- After the app was held up, only the last missed sound plays.
- Weekly goal and greeting refresh every hour (midnight included).
- Open-source licenses page in Settings (with the bundled font licenses);
  README covers the AAB build; drop the Gradle TODO.
- Tests: keep-alive logic, voice setup, session screen widget tests, call
  pause, pause timeout, catch-up, held skip events, licenses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015s4aKpitsS9iZeAcPRp1Ks
berkay merged commit 95c910b871 into main 2026-11-10 21:07:38 +03:00
berkay deleted branch review-fixes-2 2026-11-10 21:07:38 +03:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
berkay/bagdrill!22
No description provided.