Bug 2092151 - Advance onboarding only when the sync flow started from the pairing card completes #447 (firefox-autoland@autoland)

Warnings
  • Checking...
Blockers
  • Checking...
Branches bug2092151 -> autoland
Repo firefox-autoland@autoland (git) (git://github.com/corentinbect/firefox.git)
Author corentinbect
State open
Commit Title

Bug 2092151 - Advance onboarding only when the sync flow started from the pairing card completes

Commit Body

Selecting "Scan pairing code" on the the onboarding pairing sync card opened `PairFragment` and also called `scrollToNextPageOrDismiss()` immediately. This ran `OnboardingFragment.onFinish` while the scanner was still open and pairing was not complete. Onboarding was marked as complete and telemetry was recorded, but the navigation to home was skipped because `PairFragment` was the current destination. As soon as the account was connected, the sign in `LaunchedEffect` in `OnboardingScreen` called `OnboardingFragment.onFinish` another time, resulting in a duplicate event and a delayed navigation to the home screen. This patch adds `OnboardingSyncFlowResult`, an object that lets sync flows started from onboarding report flow completion. The result is stored in the `SavedStateHandle` of the previous back stack entry so that only the destination that started the flow is notified. `PairFragment` reports completion when a QR code is scanned and `SyncFlowCompletedEffect` moves to the next page once and consumes the result. Also `OnboardingFragment.onFinish` now returns early if the current destination is not the onboarding. This avoids unexpected side effects when another screen is the current destination.

Landings

Not yet Landed
There has been no attempt to land revisions in this stack.