feat: add network picker deeplink cp-7.65.0#25446
Conversation
|
Cursor Agent can help with this pull request. Just |
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
1 similar comment
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…r/network-picker-deeplink-60f5
| // The timeout is REQUIRED - React Navigation needs time to: | ||
| // 1. Complete the navigation transition | ||
| // 2. Mount the Wallet component | ||
| // 3. Make navigation context available for setParams | ||
| // Without this delay, deeplink param effects may fail | ||
| setTimeout(() => { | ||
| NavigationService.navigation.setParams({ openNetworkSelector: true }); | ||
| }, PERFORMANCE_CONFIG.NavigationParamsDelayMs); |
There was a problem hiding this comment.
Copied from perps deeplink navigation
metamask-mobile/app/core/DeeplinkManager/handlers/legacy/handlePerpsUrl.ts
Lines 154 to 167 in 8af0ce1
| onChangeTab={onChangeTab} | ||
| defiEnabled={defiEnabled} | ||
| collectiblesEnabled={collectiblesEnabled} | ||
| navigationParams={route.params} |
There was a problem hiding this comment.
Cleanup, we don't need this additional routing if we are already drilling down the navigation/route (we can use useRoute hooks)
| }, [route.params, isPerpsEnabled, navigationParams, navigation]), | ||
| ); | ||
| // Handle deep link effects | ||
| useHomeDeepLinkEffects({ |
There was a problem hiding this comment.
Abstract away deeplink effect hooks.
…ling Updated the `Wallet` component's deep link parameters to accept `null` values for `openNetworkSelector`, `shouldSelectPerpsTab`, and `initialTab`. This change ensures that the parameters are correctly set to `null` when needed, improving the handling of navigation state. Adjusted related tests to reflect these changes in expected parameter values.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Key impacts:
The changes touch:
The changes are well-covered by unit tests, but E2E validation is needed to ensure the deeplink flows work correctly in the actual app navigation context. The refactoring of existing deeplink handling code introduces some risk of regression. Performance Test Selection: |
|



Description
Add deeplink support to open the network picker modal from the home screen.
This allows users to directly open the network selection modal via a universal link to the home screen, improving navigation flow for network-specific actions.
Deeplink: https://link.metamask.io/home?openNetworkSelector=true
Changelog
CHANGELOG entry: feat: add network picker deeplink
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2571
Manual testing steps
Screenshots/Recordings
Before
After
https://www.loom.com/share/53a5b4ea0e4245be85f8c96d4871a351
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes wallet home focus-time navigation behavior and relies on delayed
setParamstiming/param clearing, which could cause unexpected navigation or regress existing deeplink flows if route params aren’t shaped as expected.Overview
Adds support for
home?openNetworkSelector=truedeeplinks by navigating toRoutes.WALLET.HOMEand then (after a delay) settingopenNetworkSelectorviaNavigationService.navigation.setParams.Refactors wallet home deeplink handling into a new
useHomeDeepLinkEffectshook that runs on screen focus, performs delayed actions (select Perps tab or open the network selector modal), and clears consumed deeplink params by setting them tonull. Updates/extends unit tests and deeplink docs to cover the new parameter and hook behavior.Written by Cursor Bugbot for commit 0220ffb. This will update automatically on new commits. Configure here.