fix(mobile): keep the screen awake while dictating - #11902
cole-robertson wants to merge 3 commits into
Conversation
Auto-lock backgrounds the app and discards an in-progress recording. Low Power Mode shortens the lock timer to 30 seconds, so longer takes are lost. Hold an expo-keep-awake lock while voice input is preparing, recording, or transcribing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
| // Keep-awake is best effort. Recording proceeds without it. | ||
| }); | ||
| return () => { | ||
| void deactivateKeepAwake(VOICE_KEEP_AWAKE_TAG); |
There was a problem hiding this comment.
🟡 Medium voice-input/useVoiceInputController.ts:170
The cleanup produces an unhandled promise rejection when deactivateKeepAwake rejects on Android after the original Activity is dead or deactivated. Handle the rejection here so focus or unmount cleanup remains best-effort.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/mobile/src/features/voice-input/useVoiceInputController.ts around line 170:
The cleanup produces an unhandled promise rejection when `deactivateKeepAwake` rejects on Android after the original Activity is dead or deactivated. Handle the rejection here so focus or unmount cleanup remains best-effort.
There was a problem hiding this comment.
Fixed in the follow-up commit: the release now swallows the rejection the same way activation does.
There was a problem hiding this comment.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a focused mobile bug fix that adds a keep-awake dependency and scopes the lock to the existing voice-input busy states, with no schema, security, billing, deployment, or static-analysis changes. An unresolved Medium-severity cleanup finding remains noted for the potential rejected deactivation promise. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
deactivateKeepAwake rejects on Android once the Activity is gone, which turned focus and unmount cleanup into an unhandled rejection. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe mobile app adds ChangesVoice input keep-awake
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The keep-awake lifecycle change has no confirmed current-head issue requiring changes before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Superseded by #12227 (merged to main) — same mobile keep-awake-during-dictation fix. Closing this PR as superseded. |
|
Closing as superseded by #12227. |
What Changed
Hold an
expo-keep-awakelock while voice input is preparing, recording, or transcribing, and release it when the controller returns to idle or error. One effect inuseVoiceInputController, keyed on the existingvoiceInputBlocksSubmissionstate, plus theexpo-keep-awakedependency inapps/mobile.Why
Starting a dictation and then holding the phone without touching the screen lets iOS auto-lock fire. Locking backgrounds the app, the controller cancels preparation, and the take is discarded. In Low Power Mode the lock timer drops to 30 seconds, which is well inside the recording limit, so this happens on most longer voice notes.
expo-keep-awakeonly disables the idle timer while the lock is held. It does not add a background mode or change audio session behavior, so pressing the side button still locks the phone as before. This is intentionally narrower than #10140, which keeps the recording alive across backgrounding.Validation: mobile
tsc --noEmit,vp fmt --check, the voice-input test files, andvp linton the changed file (warning count unchanged from main). I have not run this on a device, so the before/after video is missing. Happy to add one if a maintainer wants it before review.UI Changes
None. No visible controls change.
Checklist
🤖 Generated with Claude Code
Summary by CodeRabbit