From 3855145c4b3e9a7dc7c40ccd8eff7379f89d9b29 Mon Sep 17 00:00:00 2001 From: thekiba Date: Wed, 14 Aug 2024 16:41:00 +0400 Subject: [PATCH] feat(ui): enable direct telegram opening for all wallets in telegram --- .../desktop-connection-modal/index.tsx | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/packages/ui/src/app/views/modals/wallets-modal/desktop-connection-modal/index.tsx b/packages/ui/src/app/views/modals/wallets-modal/desktop-connection-modal/index.tsx index 7e1428ffc..3a505d112 100644 --- a/packages/ui/src/app/views/modals/wallets-modal/desktop-connection-modal/index.tsx +++ b/packages/ui/src/app/views/modals/wallets-modal/desktop-connection-modal/index.tsx @@ -1,5 +1,6 @@ import { ConnectAdditionalRequest, + isTelegramUrl, isWalletInfoCurrentlyInjected, WalletInfoInjectable, WalletInfoRemote @@ -124,23 +125,27 @@ export const DesktopConnectionModal: Component = props = setMode('desktop'); - const forceRedirect = !firstClick(); - setFirstClick(false); + if (isTelegramUrl(universalLink())) { + onClickTelegram(); + } else { + const forceRedirect = !firstClick(); + setFirstClick(false); - redirectToWallet( - universalLink()!, - props.wallet.deepLink, - { - returnStrategy: appState.returnStrategy, - forceRedirect: forceRedirect - }, - (method: 'universal-link' | 'custom-deeplink'): void => { - setLastSelectedWalletInfo({ - ...props.wallet, - openMethod: method - }); - } - ); + redirectToWallet( + universalLink()!, + props.wallet.deepLink, + { + returnStrategy: appState.returnStrategy, + forceRedirect: forceRedirect + }, + (method: 'universal-link' | 'custom-deeplink'): void => { + setLastSelectedWalletInfo({ + ...props.wallet, + openMethod: method + }); + } + ); + } }; const onClickTelegram = (): void => {