feat: QrSyncController and integration to UI (new users flow)#32078
feat: QrSyncController and integration to UI (new users flow)#32078lwin-kyaw wants to merge 7 commits into
Conversation
|
CLA Signature Action: Thank you for your submission, we really appreciate it. We ask that you read and sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just by adding a comment to this pull request with this exact sentence:
By commenting with the above message you are agreeing to the terms of the CLA. Your account will be recorded as agreeing to our CLA so you don't need to sign it again for future contributions to this repository. 0 out of 1 committers have signed the CLA. |
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
9d457f7 to
7bd4c7f
Compare
7bd4c7f to
9d457f7
Compare
# Conflicts: # app/components/Views/ImportFromSecretRecoveryPhrase/index.js
9d457f7 to
111ce97
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
⚡ Performance Test Results
❌ 3 tests failed · 20 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ❌ Failed Tests (3)
@metamask-mobile-platform
@metamask-onboarding-team
✅ Passed Tests (17)
Branch: |
Summary
This PR adds QrSyncController and integration to the UI.
Each QR sync is one short-lived session: it starts when the user scans a QR code and ends when the sync completes, is cancelled, or hits an error.
User flow (simple)
If the user goes back during an active sync, mobile cancels and tells the extension.
UI ↔ Controller communication
flowchart TB subgraph UI["Add Device screens"] Main["Add Device screen"] OTP["OTP bottom sheet"] Linked["Device added screen"] Import["Import wallet screen"] end subgraph Controller["QrSync Controller"] Phase["phase"] OTPData["otp"] Error["error"] Review["review / import plan"] end Main -->|"User scans QR"| Controller Main -->|"User taps Back"| Controller OTP -->|"User closes sheet"| Main Controller -->|"selectors read state"| Main Controller -->|"show OTP sheet"| OTP Controller -->|"device-linked"| Linked Controller -->|"reviewing-import"| Import Controller <-->|"encrypted messages"| Ext["Browser extension"]In plain terms:
phase) and related data (code, errors).The UI does not decide the step on its own. It reads the controller through selectors.
Controller phases
idleinitializingdisplaying-otpconnectedawaiting-sync-readyreviewing-importcompletedfailedSync flow (controller)
Main code changes
QrSyncPhases— named constants so UI and controller share the same step names.QrSyncController— clear phase transitions, strict session lifetime, peer notification on cancel/error.app/selectors/qrSyncController/— UI reads controller state through selectors.deviceAddedstate andDeviceEventEmitter.sync-cancel;sync-completedsent after validsync-ready(extension not blocked on import).Session rules
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist