Skip to content

Conversation

smilingkylan
Copy link
Contributor

@smilingkylan smilingkylan commented Sep 29, 2025

My first thought was to just ask AI how to do it before having to dive into such a large codebase, but I decided to do it the manual way because a lot of devs may not have access to powerful AI. At multiple points I asked myself if there were any examples somewhere in the code base. A Readme file or comments in the files may be helpful.

  1. Search “deep” and find “app/core/DeeplinkManager @MetaMask/mobile-platform” in the CODEOWNERS file
  2. Go to app/core/DeeplinkManager, see “setDeepLink” which leads me nowhere, “addEventListener(‘url’)” doesn’t tell me much because “URL” is a common term so it’d be difficult to find where it is emitted. “handleDeeplink -> checkForDeepLink -> “CHECK_FOR_DEEPLINK” which leads to Sagas:
SharedDeeplinkManager.parse(deeplink, {
    origin: AppConstants.DEEPLINKS.ORIGIN_DEEPLINK,
});

Leads me to “parse” and then “parseDeepLink”

  `case PROTOCOLS.METAMASK which uses handleMetaMaskDeeplink`
  1. Create conditional if LINK matches “SETTINGS” for example. Now we need to know how to do programmatically navigate the app. Maybe like this example from the handleMetaMaskDeeplink file?
      SDKConnect.getInstance().state.navigation?.navigate(
        Routes.MODAL.ROOT_MODAL_FLOW,
        {
          screen: Routes.SDK.RETURN_TO_DAPP_TOAST,
        },
      )
  1. AI wants to help me code complete but I’ll resist for now. Is SDKConnect.getInstance().state.navigation really what we want to be using? Take a look at the “Routes” file and see one for settings. But what are the two parameters that “navigate” needs to take? They look similar in that example… both routes? Looks like first param is the route but why does the second variable have a “screen” field? I think that must be a misnomer for a stage of a modal process. I will remove the second parameter and use the Routes. I search in app for Routes.SETTINGS_VIEW to see if I need to pass a second param. Looks like this call should hopefully do the trick:
navigation.navigate(Routes.SETTINGS_VIEW, {
     screen: 'Settings',
});
  1. Find deeplinks.ts file for the actual string route paths

  2. Does React Native have link components? Documentation says no but we can create a button and use Linking.openURL(theUrl)


  3. Button link works!

@smilingkylan smilingkylan requested review from a team as code owners September 29, 2025 18:34
Copy link
Contributor

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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Sep 29, 2025
@smilingkylan smilingkylan changed the title Deeplink to Settings View working [Ignore] Deeplink to Settings View working Sep 29, 2025
// write it in here.
if (url.startsWith(`${PREFIXES.METAMASK}${ACTIONS.SETTINGS_VIEW}`)) {
SDKConnect.getInstance().state.navigation?.navigate(Routes.SETTINGS_VIEW);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Deeplink Handler Missing Return

Missing return statement after handling SETTINGS_VIEW deeplink. Without a return, the code will continue executing subsequent if conditions, potentially triggering multiple handlers for the same URL. All other similar deeplink handlers in this function include return statements to prevent this fall-through behavior.

Fix in Cursor Fix in Web

PERPS = 'perps',
PERPS_MARKETS = 'perps-markets',
PERPS_ASSET = 'perps-asset',
SETTINGS_VIEW = 'settings-view',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing Prefix for Settings View Action

Missing PREFIXES entry for SETTINGS_VIEW action. All other actions in the ACTIONS enum have corresponding entries in the PREFIXES object (lines 42-62), but SETTINGS_VIEW is missing. This creates an inconsistent pattern and could cause issues if code elsewhere expects all actions to have defined prefixes.

Fix in Cursor Fix in Web

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 29, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template size-S team-mobile-platform Mobile Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants