FIX: can't access storage for unsigned transaction export #5559

This commit is contained in:
Marcos Rodriguez Velez 2023-07-09 12:12:05 -05:00
parent 368b15bab4
commit 3684814e21
No known key found for this signature in database
GPG key ID: 6030B2F48CCE86D7
4 changed files with 16 additions and 5 deletions

View file

@ -17,7 +17,7 @@ const writeFileAndExportToAndroidDestionation = async ({ filename, contents, des
buttonNegative: loc._.cancel,
buttonPositive: loc._.ok,
});
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
if (granted === PermissionsAndroid.RESULTS.GRANTED || Platform.Version >= 33) {
const filePath = destination + `/${filename}`;
try {
await RNFS.writeFile(filePath, contents);

View file

@ -1,12 +1,12 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { ScrollView, View, StyleSheet, Linking } from 'react-native';
import { ScrollView, View, StyleSheet, Linking, Platform } from 'react-native';
import wif from 'wif';
import bip38 from 'bip38';
import BIP32Factory from 'bip32';
import loc from '../loc';
import { BlueSpacing20, SafeBlueArea, BlueCard, BlueText, BlueLoading } from '../BlueComponents';
import { BlueSpacing20, SafeBlueArea, BlueCard, BlueText, BlueLoading, BlueButton } from '../BlueComponents';
import navigationStyle from '../components/navigationStyle';
import {
SegwitP2SHWallet,
@ -22,6 +22,7 @@ const BlueCrypto = require('react-native-blue-crypto');
const encryption = require('../blue_modules/encryption');
const BlueElectrum = require('../blue_modules/BlueElectrum');
const bip32 = BIP32Factory(ecc);
const fs = require('../blue_modules/fs');
const styles = StyleSheet.create({
center: {
@ -37,6 +38,10 @@ export default class Selftest extends Component {
};
}
onPressSaveToStorage = () => {
fs.writeFileAndExport('bluewallet-storagesave-test.txt', 'Success');
};
async componentDidMount() {
let errorMessage = '';
let isOk = true;
@ -293,6 +298,12 @@ export default class Selftest extends Component {
);
}
})()}
{Platform.OS === 'android' && (
<>
<BlueSpacing20 />
<BlueButton title="Test Save to Storage" onPress={this.onPressSaveToStorage} />
</>
)}
</ScrollView>
</BlueCard>
</SafeBlueArea>

View file

@ -76,7 +76,7 @@ const SendCreate = () => {
buttonPositive: loc._.ok,
});
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
if (granted === PermissionsAndroid.RESULTS.GRANTED || Platform.Version >= 33) {
console.log('Storage Permission: Granted');
const filePath = RNFS.DownloadDirectoryPath + `/${fileName}`;
try {

View file

@ -371,7 +371,7 @@ const WalletDetails = () => {
buttonPositive: loc._.ok,
});
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
if (granted === PermissionsAndroid.RESULTS.GRANTED || Platform.Version >= 33) {
console.log('Storage Permission: Granted');
const filePath = RNFS.DownloadDirectoryPath + `/${fileName}`;
try {