fix(scanner): navigate away before processing EIP-681 URIs#7257
Open
DanielSinclair wants to merge 1 commit intodevelopfrom
Open
fix(scanner): navigate away before processing EIP-681 URIs#7257DanielSinclair wants to merge 1 commit intodevelopfrom
DanielSinclair wants to merge 1 commit intodevelopfrom
Conversation
749e58f to
3762e5a
Compare
Scanning an EIP-681 QR code (ethereum: URI) locked the app completely β no crash, no recovery β because parseEthereumUrl navigated to SEND_FLOW while QRScannerScreen was still mounted, triggering its beforeRemove listener on every attempt and looping forever. Every other QR handler calls navigate(Routes.WALLET_SCREEN) before opening the destination. Add the same call to handleScanEthereumUrl so the scanner leaves the stack before parseEthereumUrl fires. Remove the now-redundant onSuccess() from the EIP-681 branch in onScan; navigating away loses focus and deactivates the camera via isActive automatically. Bug introduced in #5178 (react-native-vision-camera upgrade, Jan 2024).
3762e5a to
df12aac
Compare
Contributor
Author
|
Bitrise build is currently building to properly test this on device |
|
π§ͺ Flashlight Performance Report (AWS Device Farm) π Commit: f53d7a5 π View Artifacts
|
Contributor
@DanielSinclair did you get to test this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes APP-3526
What changed (plus any additional context for devs)
Scanning an EIP-681 QR code (
ethereum:URI) locked the app completely β no crash, just frozen with no recovery path.QRScannerScreenhas abeforeRemovelistener (added in #5178) that intercepts every navigation away from the scanner to deactivate the camera first. Every other QR handler (handleScanAddress,handleScanWalletConnect) callsnavigate(Routes.WALLET_SCREEN)before opening the destination, so the scanner is already out of the stack andbeforeRemovenever fires for the deep-navigation step.handleScanEthereumUrlwas the exception β it left the scanner mounted and letparseEthereumUrlpushSEND_FLOWdirectly. That triggeredbeforeRemove, which blocked the navigation, re-dispatched it, which triggeredbeforeRemoveagain β infinite loop.Fix: add
navigate(Routes.WALLET_SCREEN)at the top ofhandleScanEthereumUrl, matching every other handler. Remove theonSuccess()call from the EIP-681 branch inonScan(navigating away loses focus, deactivating the camera viaisActive).Screen recordings / screenshots
What to test
EIP-681 (the fix) β all should open the send sheet, not freeze
ethereum:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913@8453/transfer?address=0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18&uint256=5000000β Generate QR
ethereum:0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18?value=1e18β Generate QR
ethereum:0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18@8453?value=1e18β Generate QR
pay-prefixed URI (ERC-831):ethereum:pay-0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18?value=5e17β Generate QR
Regression β unmodified flows that share the scanner
0xaddress β profile sheet opensβ Generate QR
β Generate QR
β Generate QR
β Generate QR