mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
ADD: Export xPub as a file #4796
This commit is contained in:
parent
c5adbaa6ee
commit
81076a5e22
2 changed files with 28 additions and 15 deletions
|
@ -13,7 +13,6 @@ import {
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { useNavigation, useRoute, useTheme, useFocusEffect } from '@react-navigation/native';
|
import { useNavigation, useRoute, useTheme, useFocusEffect } from '@react-navigation/native';
|
||||||
import Share from 'react-native-share';
|
import Share from 'react-native-share';
|
||||||
|
|
||||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||||
import {
|
import {
|
||||||
BlueLoading,
|
BlueLoading,
|
||||||
|
|
|
@ -2,13 +2,14 @@ import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||||
import { InteractionManager, ActivityIndicator, View, StatusBar, StyleSheet } from 'react-native';
|
import { InteractionManager, ActivityIndicator, View, StatusBar, StyleSheet } from 'react-native';
|
||||||
import { useFocusEffect, useRoute, useNavigation, useTheme } from '@react-navigation/native';
|
import { useFocusEffect, useRoute, useNavigation, useTheme } from '@react-navigation/native';
|
||||||
import navigationStyle from '../../components/navigationStyle';
|
import navigationStyle from '../../components/navigationStyle';
|
||||||
import { BlueSpacing20, SafeBlueArea, BlueText, BlueCopyTextToClipboard } from '../../BlueComponents';
|
import { BlueSpacing20, SafeBlueArea, BlueText, BlueCopyTextToClipboard, BlueButton } from '../../BlueComponents';
|
||||||
import Privacy from '../../blue_modules/Privacy';
|
import Privacy from '../../blue_modules/Privacy';
|
||||||
import Biometric from '../../class/biometrics';
|
import Biometric from '../../class/biometrics';
|
||||||
import loc from '../../loc';
|
import loc from '../../loc';
|
||||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||||
import HandoffComponent from '../../components/handoff';
|
import HandoffComponent from '../../components/handoff';
|
||||||
|
import Share from 'react-native-share';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
root: {
|
root: {
|
||||||
|
@ -20,6 +21,10 @@ const styles = StyleSheet.create({
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
|
share: {
|
||||||
|
alignSelf: 'center',
|
||||||
|
width: '40%',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const WalletXpub = () => {
|
const WalletXpub = () => {
|
||||||
|
@ -68,6 +73,10 @@ const WalletXpub = () => {
|
||||||
setQRCodeSize(height > width ? width - 40 : e.nativeEvent.layout.width / 1.8);
|
setQRCodeSize(height > width ? width - 40 : e.nativeEvent.layout.width / 1.8);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleShareButtonPressed = () => {
|
||||||
|
Share.open({ message: xpub }).catch(error => console.log(error));
|
||||||
|
};
|
||||||
|
|
||||||
return isLoading ? (
|
return isLoading ? (
|
||||||
<View style={[styles.container, stylesHook.root]}>
|
<View style={[styles.container, stylesHook.root]}>
|
||||||
<ActivityIndicator />
|
<ActivityIndicator />
|
||||||
|
@ -75,21 +84,26 @@ const WalletXpub = () => {
|
||||||
) : (
|
) : (
|
||||||
<SafeBlueArea style={[styles.root, stylesHook.root]} onLayout={onLayout}>
|
<SafeBlueArea style={[styles.root, stylesHook.root]} onLayout={onLayout}>
|
||||||
<StatusBar barStyle="light-content" />
|
<StatusBar barStyle="light-content" />
|
||||||
<View style={styles.container}>
|
<>
|
||||||
{wallet && (
|
<View style={styles.container}>
|
||||||
<>
|
{wallet && (
|
||||||
<View>
|
<>
|
||||||
<BlueText>{wallet.typeReadable}</BlueText>
|
<View>
|
||||||
</View>
|
<BlueText>{wallet.typeReadable}</BlueText>
|
||||||
<BlueSpacing20 />
|
</View>
|
||||||
</>
|
<BlueSpacing20 />
|
||||||
)}
|
</>
|
||||||
<QRCodeComponent value={xpub} size={qrCodeSize} />
|
)}
|
||||||
|
<QRCodeComponent value={xpub} size={qrCodeSize} />
|
||||||
|
|
||||||
<BlueSpacing20 />
|
<BlueSpacing20 />
|
||||||
<BlueCopyTextToClipboard text={xPubText} />
|
<BlueCopyTextToClipboard text={xPubText} />
|
||||||
|
</View>
|
||||||
<HandoffComponent title={loc.wallets.xpub_title} type={HandoffComponent.activityTypes.Xpub} userInfo={{ xpub: xPubText }} />
|
<HandoffComponent title={loc.wallets.xpub_title} type={HandoffComponent.activityTypes.Xpub} userInfo={{ xpub: xPubText }} />
|
||||||
</View>
|
<View style={styles.share}>
|
||||||
|
<BlueButton onPress={handleShareButtonPressed} title={loc.receive.details_share} />
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
</SafeBlueArea>
|
</SafeBlueArea>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue