mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 01:40:12 +01:00
wip
This commit is contained in:
parent
e91a24da85
commit
84242c03ec
@ -24,19 +24,22 @@ const useHandoffListener = () => {
|
|||||||
const handleUserActivity = useCallback(
|
const handleUserActivity = useCallback(
|
||||||
(data: UserActivityData) => {
|
(data: UserActivityData) => {
|
||||||
const { activityType, userInfo } = data;
|
const { activityType, userInfo } = data;
|
||||||
|
try {
|
||||||
if (activityType === HandOffActivityType.ReceiveOnchain) {
|
if (activityType === HandOffActivityType.ReceiveOnchain) {
|
||||||
navigate('ReceiveDetailsRoot', {
|
navigate('ReceiveDetailsRoot', {
|
||||||
screen: 'ReceiveDetails',
|
screen: 'ReceiveDetails',
|
||||||
params: { address: userInfo.address },
|
params: { address: userInfo.address },
|
||||||
});
|
});
|
||||||
} else if (activityType === HandOffActivityType.Xpub) {
|
} else if (activityType === HandOffActivityType.Xpub) {
|
||||||
navigate('WalletXpubRoot', {
|
navigate('WalletXpubRoot', {
|
||||||
screen: 'WalletXpub',
|
screen: 'WalletXpub',
|
||||||
params: { xpub: userInfo.xpub },
|
params: { xpub: userInfo.xpub },
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.debug(`Unhandled activity type: ${activityType}`);
|
console.debug(`Unhandled activity type: ${activityType}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error handling user activity:', error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[navigate],
|
[navigate],
|
||||||
@ -45,16 +48,16 @@ const useHandoffListener = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!walletsInitialized || !isHandOffUseEnabled) return;
|
if (!walletsInitialized || !isHandOffUseEnabled) return;
|
||||||
|
|
||||||
const activitySubscription = eventEmitter.addListener('onUserActivityOpen', handleUserActivity);
|
const activitySubscription = eventEmitter?.addListener('onUserActivityOpen', handleUserActivity);
|
||||||
|
|
||||||
EventEmitter.getMostRecentUserActivity?.()
|
EventEmitter.getMostRecentUserActivity?.()
|
||||||
.then(handleUserActivity)
|
.then(handleUserActivity)
|
||||||
.catch(() => console.debug('No userActivity object sent'));
|
.catch(() => console.debug('No userActivity object sent'));
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
activitySubscription.remove();
|
activitySubscription?.remove();
|
||||||
};
|
};
|
||||||
}, [walletsInitialized, isHandOffUseEnabled, handleUserActivity]);
|
}, [walletsInitialized, isHandOffUseEnabled, handleUserActivity]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useHandoffListener;
|
export default useHandoffListener;
|
||||||
|
@ -499,9 +499,10 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
|
|||||||
)}
|
)}
|
||||||
</FContainer>
|
</FContainer>
|
||||||
{wallet?.chain === Chain.ONCHAIN && wallet.type !== MultisigHDWallet.type && wallet.getXpub && wallet.getXpub() ? (
|
{wallet?.chain === Chain.ONCHAIN && wallet.type !== MultisigHDWallet.type && wallet.getXpub && wallet.getXpub() ? (
|
||||||
<Button
|
<HandOffComponent
|
||||||
onPress={() => navigation.navigate('WalletXpub', { walletID: wallet.getID(), xpub: wallet.getXpub() })}
|
title={wallet.getLabel()}
|
||||||
title={loc.wallets.view_xpub}
|
type={HandOffActivityType.Xpub}
|
||||||
|
url={`https://www.blockonomics.co/#/search?q=${wallet.getXpub()}`}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
Loading…
Reference in New Issue
Block a user