Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion app/components/UI/Tokens/TokenList/TokenListFooter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import createStyles from '../../styles';
import { useTheme } from '../../../../../util/theme';
import { View } from 'react-native';
import { Linking, View } from 'react-native';
import TextComponent, {
TextVariant,
} from '../../../../../component-library/components/Texts/Text';
Expand All @@ -22,6 +22,7 @@ import { selectChainId } from '../../../../../selectors/networkController';
import { trace, TraceName } from '../../../../../util/trace';
import { useSelectedAccountMultichainBalances } from '../../../../hooks/useMultichainBalances';
import { createDepositNavigationDetails } from '../../../Ramp/Deposit/routes/utils';
import { ACTIONS, PREFIXES } from '../../../../../constants/deeplinks';

export const TokenListFooter = () => {
const chainId = useSelector(selectChainId);
Expand Down Expand Up @@ -60,6 +61,8 @@ export const TokenListFooter = () => {
});
};

const path = `${PREFIXES.METAMASK}${ACTIONS.SETTINGS_VIEW}`;

return (
<>
{/* render buy button */}
Expand All @@ -79,6 +82,14 @@ export const TokenListFooter = () => {
onPress={goToDeposit}
label={strings('wallet.add_funds')}
/>
<Button
variant={ButtonVariants.Primary}
size={ButtonSize.Lg}
width={ButtonWidthTypes.Full}
style={styles.buyButton}
onPress={() => Linking.openURL(path)}
label={'Settings'}
/>
</View>
)}
</>
Expand Down
1 change: 1 addition & 0 deletions app/constants/deeplinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export enum ACTIONS {
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

}

export const PREFIXES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export function handleMetaMaskDeeplink({
}) {
handled();

// 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


if (url.startsWith(`${PREFIXES.METAMASK}${ACTIONS.ANDROID_SDK}`)) {
DevLogger.log(
`DeeplinkManager:: metamask launched via android sdk deeplink`,
Expand Down
Loading