mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import React, { useContext } from 'react';
|
|
// @ts-ignore: react-native-handoff is not in the type definition
|
|
import Handoff from 'react-native-handoff';
|
|
import { BlueStorageContext } from '../blue_modules/storage-context';
|
|
|
|
interface HandoffComponentProps {
|
|
url?: string;
|
|
title?: string;
|
|
type: (typeof HandoffComponent.activityTypes)[keyof typeof HandoffComponent.activityTypes];
|
|
userInfo?: object;
|
|
}
|
|
|
|
interface HandoffComponentWithActivityTypes extends React.FC<HandoffComponentProps> {
|
|
activityTypes: {
|
|
ReceiveOnchain: string;
|
|
Xpub: string;
|
|
ViewInBlockExplorer: string;
|
|
};
|
|
}
|
|
|
|
const HandoffComponent: HandoffComponentWithActivityTypes = props => {
|
|
const { isHandOffUseEnabled } = useContext(BlueStorageContext);
|
|
|
|
if (isHandOffUseEnabled) {
|
|
return <Handoff {...props} />;
|
|
}
|
|
return null;
|
|
};
|
|
|
|
const activityTypes = {
|
|
ReceiveOnchain: 'io.bluewallet.bluewallet.receiveonchain',
|
|
Xpub: 'io.bluewallet.bluewallet.xpub',
|
|
ViewInBlockExplorer: 'io.bluewallet.bluewallet.blockexplorer',
|
|
};
|
|
|
|
HandoffComponent.activityTypes = activityTypes;
|
|
|
|
export default HandoffComponent;
|