Repository navigation
fix(app): surface capture failures from Quick Actions and the Home stop - #25071
sauranshbhardwaj wants to merge 2 commits into
Conversation
Since capture commands became coordinator dispatches, pauseCapture, resumeCapture and finishCapture throw when their effect fails. The live page and the processing card catch that and say "Something went wrong"; two callers did not: - The home-screen Quick Actions Mute / Unmute called pauseCapture and resumeCapture without awaiting them, so a failure was an unhandled async error and the user saw nothing. - The Home record button's stop path awaited finishCapture without a try, and its tap handlers dropped the future, so a failed stop was unhandled too and the button kept its state. Both now await the command inside a try and show the same feedback as the live page; the fire-and-forget call sites say so with unawaited. The stop analytics event and the options tip are skipped when the stop did not happen. Fixes BasedHardware#19245
|
The production change here is correct and nicely scoped - both silent-failure paths now match the error handling the live page already has, with real tests through the production dispatch path. Positive signal rather than formal approval; a maintainer should take the merge. Verified against the diff and current main:
Also confirmed this is not superseded: issue #19245 is still open and main still carries the unguarded _toggleMute (this is the third attempt after #21303 and #24835). UX: users get a visible "Something went wrong" instead of nothing when mute/unmute/stop fails; the success path is unchanged. USER IMPACT: when muting or unmuting from the home-screen shortcut, or stopping a recording from Home, fails, the app now tells you instead of staying silent. What I'd still want: nothing blocking. Optional nit - both new catch (_) blocks discard the error object; a debug-level log would aid field diagnosis, though this matches the existing start-path style in the same file. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Both new catch blocks showed the feedback but dropped the error. Log it at debug level, as the rest of the app does, so a refused pause, resume or stop can be read back from the in-app log.
|
Added a debug log in both new catch blocks so the failure shows up in the in-app log. Tests re-run locally and still green. |
|
Since my last review: addressed (the one outstanding nit — both new catch blocks now keep the error and log it at debug level: My conclusion stands: a correct, well-scoped fix with tests exercising the production dispatch path. Positive signal rather than formal approval; a maintainer can take the merge. USER IMPACT: when muting or unmuting from the home-screen shortcut, or stopping a recording from Home, fails, the app now tells you — and logs why — instead of staying silent. Nothing further requested. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Fixes #19245
What changed and why
Since capture commands became coordinator dispatches,
pauseCapture,resumeCaptureandfinishCapturethrow when their effect fails (outcome.throwIfFailed()). The live page, the processing card and Device settings catch that and show "Something went wrong". Two callers did not, so a failed pause, resume or stop was an unhandled async error and the user saw nothing:app/lib/services/quick_actions_service.dart):_toggleMutecalledpauseCapture()/resumeCapture()without awaiting them. It now awaits the command inside atryand on failure showsOmiFeedback.error(context, context.l10n.somethingWentWrong)behind acontext.mountedguard._handleShortcutreturnsFuture<void>so the mute cases can await, and the platform callback wraps it inunawaitedto say the fire-and-forget is intended.app/lib/pages/home/widgets/battery_info_widget.dart):_startPhoneRecordingawaitedfinishCapture()with notry, and the two tap handlers plus the pendant sheet's "Record with phone" dropped the future. The stop now mirrors the start path in the same method (try/OmiFeedback.error/return), so thephoneMicRecordingStoppedanalytics event and the options tip are skipped when the stop did not happen. The three call sites useunawaited.Both failure paths also log the error at debug level (
Logger.debug), as the rest of the app does, so a refused pause, resume or stop can be read back from the in-app log. Nothing changes on success. This takes the same shape as #21303 (approved, then withdrawn by its author) and #24835 (closed by its author). Changelog fragment:app/changelog/unreleased/quick-actions-home-record-failure-feedback.json.Product invariants affected
none
How it was verified
flutter analyzeon the four changed files: no issues.flutter test test/services/quick_actions_service_test.dart test/widgets/capture_home_ui_test.dart: 40 passed, 2 skipped.bash test.sh(the full hermetic app suite): 8,545 passed, 10 skipped, exit 0.Found 0 widgets with text "Something went wrong! Please try again later", the error having gone to the zone's handler instead.CaptureProviderthat throws.Tests
test/services/quick_actions_service_test.dart, "Mute and Unmute shortcuts await the capture command and say so when it fails": theQuickActionsfake now keeps the handler the service registers, so the test firesmuteandunmutethrough the production dispatch. A failing resume shows the feedback andtester.takeException()stays null.test/widgets/capture_home_ui_test.dart, "a tap while the phone records finishes the capture" (onefinishCapture, no start, no toast) and "a stop that fails says so instead of an unhandled error". The fakeCaptureProvidergainsfinishCapturewith an injectable failure.UI evidence
UI-Evidence: none -- error handling only; the feedback is the existing OmiFeedback snackbar, and no layout or visual state changes.
Failure class (fixes)
Failure-Class: none