From c6208383fb1f4b9aa2757111cc8fe76b6f800af6 Mon Sep 17 00:00:00 2001 From: ignaciosantise <25931366+ignaciosantise@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:28:20 -0300 Subject: [PATCH] fix: added wc: old links to listener --- .../src/screens/Connections/index.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/wallets/rn_cli_wallet/src/screens/Connections/index.tsx b/wallets/rn_cli_wallet/src/screens/Connections/index.tsx index a67b764d..7ba190a4 100644 --- a/wallets/rn_cli_wallet/src/screens/Connections/index.tsx +++ b/wallets/rn_cli_wallet/src/screens/Connections/index.tsx @@ -46,21 +46,20 @@ export default function Connections({route}: Props) { } const deeplinkCallback = useCallback(({url}: {url: string}) => { - if (!url.includes('wc?uri=')) { - return; + if (url.includes('wc?uri=')) { + const uri = url.split('wc?uri=')[1]; + pair(decodeURIComponent(uri)); + } else if (url.includes('wc:')) { + pair(url); } - - const uri = url.split('wc?uri=')[1]; - pair(decodeURIComponent(uri)); }, []); // Handle deep link if app was closed useEffect(() => { - if (initialUrl && initialUrl.includes('wc?uri=') && !processing) { - const uri = initialUrl.split('wc?uri=')[1]; - pair(decodeURIComponent(uri)); + if (initialUrl && !processing) { + deeplinkCallback({url: initialUrl}); } - }, [initialUrl, processing]); + }, [initialUrl, processing, deeplinkCallback]); useEffect(() => { // Handle deep link if app was in background