Skip to content

Commit

Permalink
fix: added wc: old links to listener
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciosantise committed Jul 16, 2024
1 parent e10843d commit c620838
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions wallets/rn_cli_wallet/src/screens/Connections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c620838

Please sign in to comment.