mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
FIX: Unable to import files in Android 13+
This commit is contained in:
parent
b3cb25bd78
commit
d6d905a3bf
3 changed files with 15 additions and 12 deletions
|
@ -10,11 +10,15 @@
|
|||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.ACTION_OPEN_DOCUMENT" />
|
||||
<uses-permission android:name="android.permission.ACTION_GET_CONTENT" />
|
||||
<uses-permission android:name="android.permission.ACTION_CREATE_DOCUMENT" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
|
@ -24,7 +28,6 @@
|
|||
android:allowBackup="false"
|
||||
android:largeHeap="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
|
|
|
@ -161,6 +161,7 @@ const takePhotoWithImagePickerAndReadPhoto = () => {
|
|||
const showFilePickerAndReadFile = async function () {
|
||||
try {
|
||||
const res = await DocumentPicker.pickSingle({
|
||||
copyTo: 'cachesDirectory',
|
||||
type:
|
||||
Platform.OS === 'ios'
|
||||
? [
|
||||
|
@ -174,22 +175,21 @@ const showFilePickerAndReadFile = async function () {
|
|||
: [DocumentPicker.types.allFiles],
|
||||
});
|
||||
|
||||
const uri = Platform.OS === 'ios' ? decodeURI(res.uri) : res.uri;
|
||||
// ^^ some weird difference on how spaces in filenames are treated on ios and android
|
||||
const fileCopyUri = decodeURI(res.fileCopyUri);
|
||||
|
||||
let file = false;
|
||||
if (res.uri.toLowerCase().endsWith('.psbt')) {
|
||||
if (res.fileCopyUri.toLowerCase().endsWith('.psbt')) {
|
||||
// this is either binary file from ElectrumDesktop OR string file with base64 string in there
|
||||
file = await _readPsbtFileIntoBase64(uri);
|
||||
return { data: file, uri: decodeURI(res.uri) };
|
||||
file = await _readPsbtFileIntoBase64(fileCopyUri);
|
||||
return { data: file, uri: decodeURI(res.fileCopyUri) };
|
||||
}
|
||||
|
||||
if (res?.type === DocumentPicker.types.images || res?.type?.startsWith('image/')) {
|
||||
return new Promise(resolve => {
|
||||
const uri2 = res.uri.toString().replace('file://', '');
|
||||
const uri2 = res.fileCopyUri.toString().replace('file://', '');
|
||||
LocalQRCode.decode(decodeURI(uri2), (error, result) => {
|
||||
if (!error) {
|
||||
resolve({ data: result, uri: decodeURI(res.uri) });
|
||||
resolve({ data: result, fileCopyUri });
|
||||
} else {
|
||||
resolve({ data: false, uri: false });
|
||||
}
|
||||
|
@ -197,8 +197,8 @@ const showFilePickerAndReadFile = async function () {
|
|||
});
|
||||
}
|
||||
|
||||
file = await RNFS.readFile(uri);
|
||||
return { data: file, uri: decodeURI(res.uri) };
|
||||
file = await RNFS.readFile(fileCopyUri);
|
||||
return { data: file, fileCopyUri };
|
||||
} catch (err) {
|
||||
if (!DocumentPicker.isCancel(err)) {
|
||||
alert(err.message);
|
||||
|
|
|
@ -284,7 +284,7 @@ const WalletsList = () => {
|
|||
};
|
||||
|
||||
const onScanButtonPressed = () => {
|
||||
scanQrHelper(navigate, routeName, false).then(onBarScanned);
|
||||
scanQrHelper(navigate, routeName).then(onBarScanned);
|
||||
};
|
||||
|
||||
const onBarScanned = value => {
|
||||
|
|
Loading…
Add table
Reference in a new issue