FIX: Support importing JSON but not opening from outside

This commit is contained in:
Marcos Rodriguez Velez 2024-09-09 21:39:35 -04:00
parent 947d612944
commit 24e160d03e
4 changed files with 10 additions and 26 deletions

View File

@ -93,7 +93,10 @@ export const writeFileAndExport = async function (fileName: string, contents: st
export const openSignedTransaction = async function (): Promise<string | false> {
try {
const res = await DocumentPicker.pickSingle({
type: Platform.OS === 'ios' ? ['io.bluewallet.psbt', 'io.bluewallet.psbt.txn'] : [DocumentPicker.types.allFiles],
type:
Platform.OS === 'ios'
? ['io.bluewallet.psbt', 'io.bluewallet.psbt.txn', DocumentPicker.types.json]
: [DocumentPicker.types.allFiles],
});
return await _readPsbtFileIntoBase64(res.uri);
@ -160,7 +163,7 @@ export const showFilePickerAndReadFile = async function (): Promise<{ data: stri
'io.bluewallet.psbt.txn',
'io.bluewallet.backup',
DocumentPicker.types.plainText,
'public.json',
DocumentPicker.types.json,
DocumentPicker.types.images,
]
: [DocumentPicker.types.allFiles],

View File

@ -58,18 +58,6 @@
<string>io.bluewallet.backup</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>JSON File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.json</string>
</array>
</dict>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
@ -239,10 +227,6 @@
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.json</string>
</array>
<key>UTTypeDescription</key>
<string>BW COSIGNER</string>
<key>UTTypeIconFiles</key>
@ -288,8 +272,6 @@
<string>JSON File</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>public.json</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@ -360,10 +342,6 @@
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.json</string>
</array>
<key>UTTypeDescription</key>
<string>BW COSIGNER</string>
<key>UTTypeIconFiles</key>

View File

@ -741,7 +741,7 @@ const SendDetails = () => {
const res = await DocumentPicker.pickSingle({
type:
Platform.OS === 'ios'
? ['io.bluewallet.psbt', 'io.bluewallet.psbt.txn', DocumentPicker.types.plainText, 'public.json']
? ['io.bluewallet.psbt', 'io.bluewallet.psbt.txn', DocumentPicker.types.plainText, DocumentPicker.types.json]
: [DocumentPicker.types.allFiles],
});

View File

@ -196,7 +196,10 @@ const PsbtWithHardwareWallet = () => {
const openSignedTransaction = async () => {
try {
const res = await DocumentPicker.pickSingle({
type: Platform.OS === 'ios' ? ['io.bluewallet.psbt', 'io.bluewallet.psbt.txn'] : [DocumentPicker.types.allFiles],
type:
Platform.OS === 'ios'
? ['io.bluewallet.psbt', 'io.bluewallet.psbt.txn', DocumentPicker.types.json]
: [DocumentPicker.types.allFiles],
});
const file = await RNFS.readFile(res.uri);
if (file) {