From e69ae6e089c4e0a7f8d7bc102505c393949ef8ec Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Sat, 23 Mar 2024 17:27:57 -0400 Subject: [PATCH] FIX: Use filename for alert --- blue_modules/fs.ts | 8 ++++---- loc/en.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/blue_modules/fs.ts b/blue_modules/fs.ts index f845a415e..8ad87a365 100644 --- a/blue_modules/fs.ts +++ b/blue_modules/fs.ts @@ -27,9 +27,9 @@ const _shareOpen = async (filePath: string) => { * Writes a file to fs, and triggers an OS sharing dialog, so user can decide where to put this file (share to cloud * or perhabs messaging app). Provided filename should be just a file name, NOT a path */ -export const writeFileAndExport = async function (filename: string, contents: string, showShareDialog: boolean = true) { +export const writeFileAndExport = async function (fileName: string, contents: string, showShareDialog: boolean = true) { if (Platform.OS === 'ios') { - const filePath = RNFS.TemporaryDirectoryPath + `/${filename}`; + const filePath = RNFS.TemporaryDirectoryPath + `/${fileName}`; await RNFS.writeFile(filePath, contents); await _shareOpen(filePath); } else if (Platform.OS === 'android') { @@ -44,14 +44,14 @@ export const writeFileAndExport = async function (filename: string, contents: st // In Android 13 no WRITE_EXTERNAL_STORAGE permission is needed // @see https://stackoverflow.com/questions/76311685/permissionandroid-request-always-returns-never-ask-again-without-any-prompt-r if (granted === PermissionsAndroid.RESULTS.GRANTED || Platform.Version >= 30) { - const filePath = RNFS.DownloadDirectoryPath + `/${filename}`; + const filePath = RNFS.DownloadDirectoryPath + `/${fileName}`; try { await RNFS.writeFile(filePath, contents); console.log(`file saved to ${filePath}`); if (showShareDialog) { await _shareOpen(filePath); } else { - presentAlert({ message: loc.formatString(loc.send.file_saved_at_path, { filePath }) }); + presentAlert({ message: loc.formatString(loc.send.file_saved_at_path, { fileName }) }); } } catch (e: any) { console.log(e); diff --git a/loc/en.json b/loc/en.json index 13073a9da..8f1ac4b01 100644 --- a/loc/en.json +++ b/loc/en.json @@ -211,7 +211,7 @@ "reset_amount_confirm": "Would you like to reset the amount?", "success_done": "Done", "txSaved": "The transaction file ({filePath}) has been saved in your Downloads folder.", - "file_saved_at_path": "The file has been saved in your Downloads folder ({filePath}).", + "file_saved_at_path": "The file ({fileName}) has been saved in your Downloads folder.", "problem_with_psbt": "Problem with PSBT" }, "settings": {