From c3f8b9ac81b916272bc1b2aa7b9c35027c8c4bbe Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Tue, 9 Jan 2024 11:40:29 -0400 Subject: [PATCH] ADD: Test for file import --- Navigation.js | 6 +++++- screen/selftest.js | 27 ++++++++++++++++++++------- screen/wallets/addMultisigStep2.js | 4 +--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Navigation.js b/Navigation.js index 8188cdd03..307b29993 100644 --- a/Navigation.js +++ b/Navigation.js @@ -322,7 +322,11 @@ const AztecoRedeemRoot = () => { const ScanQRCodeStack = createNativeStackNavigator(); const ScanQRCodeRoot = () => ( - + ); diff --git a/screen/selftest.js b/screen/selftest.js index f54595851..a628bf51b 100644 --- a/screen/selftest.js +++ b/screen/selftest.js @@ -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' && ( - <> - -