Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(12527): sdk connection with unknown url causes a bug #12566

Merged
Merged
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
16 changes: 14 additions & 2 deletions app/components/Views/AccountConnect/AccountConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ const AccountConnect = (props: AccountConnectProps) => {
const dappIconUrl = sdkConnection?.originatorInfo?.icon;
const dappUrl = sdkConnection?.originatorInfo?.url ?? '';

const [isSdkUrlUnknown, setIsSdkUrlUnknown] = useState(false);

const { domainTitle, hostname } = useMemo(() => {
let title = '';
let dappHostname = dappUrl || channelIdOrHostname;
Expand All @@ -178,6 +180,7 @@ const AccountConnect = (props: AccountConnectProps) => {
dappHostname = inappBrowserOrigin;
} else {
title = strings('sdk.unknown');
setIsSdkUrlUnknown(true);
}

return { domainTitle: title, hostname: dappHostname };
Expand Down Expand Up @@ -357,7 +360,13 @@ const AccountConnect = (props: AccountConnectProps) => {
.build(),
);
},
[accountsLength, channelIdOrHostname, trackEvent, createEventBuilder, eventSource],
[
accountsLength,
channelIdOrHostname,
trackEvent,
createEventBuilder,
eventSource,
],
);

const navigateToUrlInEthPhishingModal = useCallback(
Expand Down Expand Up @@ -799,7 +808,9 @@ const AccountConnect = (props: AccountConnectProps) => {
const renderConnectScreens = useCallback(() => {
switch (screen) {
case AccountConnectScreens.SingleConnect:
return isMultichainVersion1Enabled
return isSdkUrlUnknown
? renderSingleConnectScreen()
: isMultichainVersion1Enabled
? renderPermissionsSummaryScreen()
: renderSingleConnectScreen();
case AccountConnectScreens.SingleConnectSelector:
Expand All @@ -811,6 +822,7 @@ const AccountConnect = (props: AccountConnectProps) => {
}
}, [
screen,
isSdkUrlUnknown,
renderSingleConnectScreen,
renderPermissionsSummaryScreen,
renderSingleConnectSelectorScreen,
Expand Down
Loading