diff --git a/hooks/useHandoffListener.ios.ts b/hooks/useHandoffListener.ios.ts index 2762b84af..df9ecec3d 100644 --- a/hooks/useHandoffListener.ios.ts +++ b/hooks/useHandoffListener.ios.ts @@ -24,19 +24,22 @@ const useHandoffListener = () => { const handleUserActivity = useCallback( (data: UserActivityData) => { const { activityType, userInfo } = data; - - if (activityType === HandOffActivityType.ReceiveOnchain) { - navigate('ReceiveDetailsRoot', { - screen: 'ReceiveDetails', - params: { address: userInfo.address }, - }); - } else if (activityType === HandOffActivityType.Xpub) { - navigate('WalletXpubRoot', { - screen: 'WalletXpub', - params: { xpub: userInfo.xpub }, - }); - } else { - console.debug(`Unhandled activity type: ${activityType}`); + try { + if (activityType === HandOffActivityType.ReceiveOnchain) { + navigate('ReceiveDetailsRoot', { + screen: 'ReceiveDetails', + params: { address: userInfo.address }, + }); + } else if (activityType === HandOffActivityType.Xpub) { + navigate('WalletXpubRoot', { + screen: 'WalletXpub', + params: { xpub: userInfo.xpub }, + }); + } else { + console.debug(`Unhandled activity type: ${activityType}`); + } + } catch (error) { + console.error('Error handling user activity:', error); } }, [navigate], @@ -45,16 +48,16 @@ const useHandoffListener = () => { useEffect(() => { if (!walletsInitialized || !isHandOffUseEnabled) return; - const activitySubscription = eventEmitter.addListener('onUserActivityOpen', handleUserActivity); + const activitySubscription = eventEmitter?.addListener('onUserActivityOpen', handleUserActivity); EventEmitter.getMostRecentUserActivity?.() .then(handleUserActivity) .catch(() => console.debug('No userActivity object sent')); return () => { - activitySubscription.remove(); + activitySubscription?.remove(); }; }, [walletsInitialized, isHandOffUseEnabled, handleUserActivity]); }; -export default useHandoffListener; \ No newline at end of file +export default useHandoffListener; diff --git a/screen/wallets/WalletTransactions.tsx b/screen/wallets/WalletTransactions.tsx index 249a6cbbc..1ee221b5a 100644 --- a/screen/wallets/WalletTransactions.tsx +++ b/screen/wallets/WalletTransactions.tsx @@ -499,9 +499,10 @@ const WalletTransactions: React.FC = ({ route }) => { )} {wallet?.chain === Chain.ONCHAIN && wallet.type !== MultisigHDWallet.type && wallet.getXpub && wallet.getXpub() ? ( -