mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
ADD: Show alert on Android if storage access is denied.
This commit is contained in:
parent
1b465c06a9
commit
11acebed92
@ -1,5 +1,5 @@
|
||||
/* global alert */
|
||||
import { PermissionsAndroid, Platform } from 'react-native';
|
||||
import { Alert, Linking, PermissionsAndroid, Platform } from 'react-native';
|
||||
import RNFS from 'react-native-fs';
|
||||
import Share from 'react-native-share';
|
||||
import loc from '../loc';
|
||||
@ -39,6 +39,16 @@ const writeFileAndExport = async function (filename, contents) {
|
||||
alert(loc.formatString(loc._.file_saved, { filePath: filename }));
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
Alert.alert(loc.send.permission_storage_title, loc.send.permission_storage_denied_message, [
|
||||
{
|
||||
text: loc.send.open_settings,
|
||||
onPress: () => {
|
||||
Linking.openSettings();
|
||||
},
|
||||
style: 'default',
|
||||
},
|
||||
{ text: loc._.cancel, onPress: () => {}, style: 'cancel' },
|
||||
]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -208,7 +208,8 @@
|
||||
"open_settings": "Open Settings",
|
||||
"permission_storage_later": "Ask Me Later",
|
||||
"permission_storage_message": "BlueWallet needs your permission to access your storage to save this transaction.",
|
||||
"permission_storage_title": "BlueWallet Storage Access Permission",
|
||||
"permission_storage_denied_message": "BlueWallet is unable save this transaction. Please, open your device settings and enable Storage Permission.",
|
||||
"permission_storage_title": "Storage Access Permission",
|
||||
"psbt_clipboard": "Copy to Clipboard",
|
||||
"psbt_this_is_psbt": "This is a partially signed bitcoin transaction (PSBT). Please finish signing it with your hardware wallet.",
|
||||
"psbt_tx_export": "Export to file",
|
||||
|
@ -14,6 +14,7 @@ import {
|
||||
View,
|
||||
Platform,
|
||||
PermissionsAndroid,
|
||||
Alert,
|
||||
} from 'react-native';
|
||||
import Clipboard from '@react-native-community/clipboard';
|
||||
import { Icon } from 'react-native-elements';
|
||||
@ -84,6 +85,16 @@ export default class SendCreate extends Component {
|
||||
alert(loc.formatString(loc.send.txSaved, { filePath }));
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
Alert.alert(loc.send.permission_storage_title, loc.send.permission_storage_denied_message, [
|
||||
{
|
||||
text: loc.send.open_settings,
|
||||
onPress: () => {
|
||||
Linking.openSettings();
|
||||
},
|
||||
style: 'default',
|
||||
},
|
||||
{ text: loc._.cancel, onPress: () => {}, style: 'cancel' },
|
||||
]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
PermissionsAndroid,
|
||||
Text,
|
||||
StyleSheet,
|
||||
Alert,
|
||||
} from 'react-native';
|
||||
import ImagePicker from 'react-native-image-picker';
|
||||
import Clipboard from '@react-native-community/clipboard';
|
||||
@ -34,6 +35,7 @@ import ScanQRCode from './ScanQRCode';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import { useNavigation, useRoute, useTheme } from '@react-navigation/native';
|
||||
import isCatalyst from 'react-native-is-catalyst';
|
||||
const BlueElectrum = require('../../blue_modules/BlueElectrum');
|
||||
/** @type {AppStorage} */
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
@ -178,7 +180,7 @@ const PsbtWithHardwareWallet = () => {
|
||||
await RNFS.writeFile(filePath, typeof psbt === 'string' ? psbt : psbt.toBase64());
|
||||
Share.open({
|
||||
url: 'file://' + filePath,
|
||||
saveToFiles: isDesktop,
|
||||
saveToFiles: isCatalyst,
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
@ -202,6 +204,16 @@ const PsbtWithHardwareWallet = () => {
|
||||
alert(loc.formatString(loc.send.txSaved, { filePath: fileName }));
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
Alert.alert(loc.send.permission_storage_title, loc.send.permission_storage_denied_message, [
|
||||
{
|
||||
text: loc.send.open_settings,
|
||||
onPress: () => {
|
||||
Linking.openSettings();
|
||||
},
|
||||
style: 'default',
|
||||
},
|
||||
{ text: loc._.cancel, onPress: () => {}, style: 'cancel' },
|
||||
]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -283,6 +283,16 @@ const WalletDetails = () => {
|
||||
alert(loc.formatString(loc.send.txSaved, { filePath: fileName }));
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
Alert.alert(loc.send.permission_storage_title, loc.send.permission_storage_denied_message, [
|
||||
{
|
||||
text: loc.send.open_settings,
|
||||
onPress: () => {
|
||||
Linking.openSettings();
|
||||
},
|
||||
style: 'default',
|
||||
},
|
||||
{ text: loc._.cancel, onPress: () => {}, style: 'cancel' },
|
||||
]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user