Open
Description
Hello,
While it works in iOS, the cpExternal
does not work in iOS. Note that I have both UIFileSharingEnabled
and LSSupportsOpeningDocumentsInPlace
enabled. Testing in emulator. Shouldn't the destination ('downloads') be a "common" folder and not an application-specific folder?
Is this a bug or a non-proper implementation?
Thanks a lot!
const fetchPayment = async (paymentId, createdDate) => {
const token = await getAuthToken();
console.log('token', token);
const destPath = `${Dirs.CacheDir}/${createdDate}-Invoice.pdf`;
// const date = new Date();
const { data } = await new Promise((resolve, reject) => {
try {
FileSystem.fetch(
`${window.our.BASE_URL}/payment?paymentId=${paymentId}`,
{
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/pdf',
'Content-Type': 'application/pdf',
},
path: destPath,
},
)
.then(async res => {
console.log('res', res);
await FileSystem.cpExternal(
destPath,
`${createdDate}-Invoice.pdf`,
'downloads',
);
Alert.alert(
t('invoiceDownloaded'),
t('invoiceDownloadedAndroidFolder'),
);
resolve(res);
})
// Something went wrong:
.catch((errorMessage, statusCode) => {
console.log(errorMessage);
reject(errorMessage);
});
} catch (err) {
console.log(err);
reject(err);
}
});
return data;
};
Metadata
Metadata
Assignees
Labels
No labels