Closed Bug 2092151 Opened 6 days ago Closed 2 days ago

Home opens with a delay when pairing from the onboarding pairing card

Categories

(Firefox for Android :: Accounts and Sync, defect)

All
Android
defect
Points:
2

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: corentin, Assigned: corentin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid][android-activation-trust])

Attachments

(1 external file, 1 obsolete file)

When the onboarding pairing sync card is the last onboarding page, selecting "Scan pairing code" opens the PairFragmentand also calls scrollToNextPageOrDismiss(). This runs OnboardingFragment.onFinish while the scanner is still open and pairing is not complete. The navigation to home triggered in this method is skipped because PairFragment is the current destination. At that point the onboarding is marked as complete, and so does telemetry.

After pairing using the scanner, the user is brought back to the onboarding pairing card for a short time. The app navigates to the home screen after 1 or 2 seconds, once the account is connected and scrollToNextCardFromSignIn calls OnboardingFragment.onFinish again. As a result OnboardingFragment.onFinish runs twice and the related event is recorded twice.

No longer depends on: 2092124
Type: task → defect
Points: --- → 2
Blocks: 2092623

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.

Attachment #9683380 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 2 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: