mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-03 20:07:11 +01:00
ADD: Test for file import
This commit is contained in:
parent
d6d905a3bf
commit
c3f8b9ac81
3 changed files with 26 additions and 11 deletions
|
@ -322,7 +322,11 @@ const AztecoRedeemRoot = () => {
|
|||
|
||||
const ScanQRCodeStack = createNativeStackNavigator();
|
||||
const ScanQRCodeRoot = () => (
|
||||
<ScanQRCodeStack.Navigator initialRouteName='ScanQRCode' name="ScanQRCodeRoot" screenOptions={{ headerShown: false, presentation: 'fullScreenModal' }}>
|
||||
<ScanQRCodeStack.Navigator
|
||||
initialRouteName="ScanQRCode"
|
||||
name="ScanQRCodeRoot"
|
||||
screenOptions={{ headerShown: false, presentation: 'fullScreenModal' }}
|
||||
>
|
||||
<ScanQRCodeStack.Screen name="ScanQRCode" component={ScanQRCode} initialParams={ScanQRCode.initialParams} />
|
||||
</ScanQRCodeStack.Navigator>
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ScrollView, View, StyleSheet, Linking, Platform } from 'react-native';
|
||||
import { ScrollView, View, StyleSheet, Linking } from 'react-native';
|
||||
import wif from 'wif';
|
||||
import bip38 from 'bip38';
|
||||
import BIP32Factory from 'bip32';
|
||||
|
@ -19,6 +19,7 @@ import {
|
|||
import ecc from '../blue_modules/noble_ecc';
|
||||
import Button from '../components/Button';
|
||||
import SafeArea from '../components/SafeArea';
|
||||
import alert from '../components/Alert';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const BlueCrypto = require('react-native-blue-crypto');
|
||||
const encryption = require('../blue_modules/encryption');
|
||||
|
@ -44,6 +45,20 @@ export default class Selftest extends Component {
|
|||
fs.writeFileAndExport('bluewallet-storagesave-test.txt', 'Success');
|
||||
};
|
||||
|
||||
onPressImportDocument = async () => {
|
||||
try {
|
||||
fs.showFilePickerAndReadFile().then(file => {
|
||||
if (file && file.data && file.data.length > 0) {
|
||||
alert(file.data);
|
||||
} else {
|
||||
alert('Error reading file');
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
};
|
||||
|
||||
async componentDidMount() {
|
||||
let errorMessage = '';
|
||||
let isOk = true;
|
||||
|
@ -300,12 +315,10 @@ export default class Selftest extends Component {
|
|||
);
|
||||
}
|
||||
})()}
|
||||
{Platform.OS === 'android' && (
|
||||
<>
|
||||
<BlueSpacing20 />
|
||||
<Button title="Test Save to Storage" onPress={this.onPressSaveToStorage} />
|
||||
</>
|
||||
)}
|
||||
<BlueSpacing20 />
|
||||
<Button title="Test Save to Storage" onPress={this.onPressSaveToStorage} />
|
||||
<BlueSpacing20 />
|
||||
<Button title="Test Save to File Import" onPress={this.onPressImportDocument} />
|
||||
</ScrollView>
|
||||
</BlueCard>
|
||||
</SafeArea>
|
||||
|
|
|
@ -461,9 +461,7 @@ const WalletsAddMultisigStep2 = () => {
|
|||
fs.showActionSheet({ anchor: findNodeHandle(openScannerButton.current) }).then(onBarScanned);
|
||||
} else {
|
||||
setIsProvideMnemonicsModalVisible(false);
|
||||
InteractionManager.runAfterInteractions(() =>
|
||||
scanQrHelper(navigation.navigate, onBarScanned)
|
||||
);
|
||||
InteractionManager.runAfterInteractions(() => scanQrHelper(navigation.navigate, onBarScanned));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue