From 6acc22e2e111e501540f4227a16db7d47f506475 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Wed, 28 Aug 2024 22:05:35 +0530 Subject: [PATCH 1/4] fixes issue --- src/pages/iou/request/step/IOURequestStepScan/index.native.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 9c24e92689cc..235f6b11cf4b 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -446,8 +446,7 @@ function IOURequestStepScan({ }) .then((photo: PhotoFile) => { // Store the receipt on the transaction object in Onyx - const source = `file://${photo.path}`; - IOU.setMoneyRequestReceipt(transactionID, source, photo.path, action !== CONST.IOU.ACTION.EDIT); + IOU.setMoneyRequestReceipt(transactionID, photo.path, photo.path, action !== CONST.IOU.ACTION.EDIT); FileUtils.readFileAsync(source, photo.path, (file) => { if (action === CONST.IOU.ACTION.EDIT) { From 32aa6ad51de312d60359896c093a7f9b6ea79453 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Wed, 28 Aug 2024 22:09:45 +0530 Subject: [PATCH 2/4] fix lint --- .../iou/request/step/IOURequestStepScan/index.native.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 235f6b11cf4b..7b4ad4955952 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -448,13 +448,13 @@ function IOURequestStepScan({ // Store the receipt on the transaction object in Onyx IOU.setMoneyRequestReceipt(transactionID, photo.path, photo.path, action !== CONST.IOU.ACTION.EDIT); - FileUtils.readFileAsync(source, photo.path, (file) => { + FileUtils.readFileAsync(photo.path, photo.path, (file) => { if (action === CONST.IOU.ACTION.EDIT) { - updateScanAndNavigate(file, source); + updateScanAndNavigate(file, photo.path); return; } setDidCapturePhoto(true); - navigateToConfirmationStep(file, source); + navigateToConfirmationStep(file, photo.path); }); }) .catch((error: string) => { From 88dc536b1b141b5d3095b03923ab9eac04fcb534 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Wed, 28 Aug 2024 22:13:40 +0530 Subject: [PATCH 3/4] clean up --- .../iou/request/step/IOURequestStepScan/index.native.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 7b4ad4955952..d97df95382d6 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -446,15 +446,16 @@ function IOURequestStepScan({ }) .then((photo: PhotoFile) => { // Store the receipt on the transaction object in Onyx - IOU.setMoneyRequestReceipt(transactionID, photo.path, photo.path, action !== CONST.IOU.ACTION.EDIT); + const source = `${photo.path}`; + IOU.setMoneyRequestReceipt(transactionID, source, photo.path, action !== CONST.IOU.ACTION.EDIT); - FileUtils.readFileAsync(photo.path, photo.path, (file) => { + FileUtils.readFileAsync(source, photo.path, (file) => { if (action === CONST.IOU.ACTION.EDIT) { - updateScanAndNavigate(file, photo.path); + updateScanAndNavigate(file, source); return; } setDidCapturePhoto(true); - navigateToConfirmationStep(file, photo.path); + navigateToConfirmationStep(file, source); }); }) .catch((error: string) => { From c68e8f826e2dd4bc264eb72976f652e3bd1eb1fe Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Thu, 29 Aug 2024 00:20:08 +0530 Subject: [PATCH 4/4] fixes android capture --- src/libs/fileDownload/getPhotoSource/index.android.ts | 5 +++++ src/libs/fileDownload/getPhotoSource/index.ts | 5 +++++ .../iou/request/step/IOURequestStepScan/index.native.tsx | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/libs/fileDownload/getPhotoSource/index.android.ts create mode 100644 src/libs/fileDownload/getPhotoSource/index.ts diff --git a/src/libs/fileDownload/getPhotoSource/index.android.ts b/src/libs/fileDownload/getPhotoSource/index.android.ts new file mode 100644 index 000000000000..2d44d7fbf2db --- /dev/null +++ b/src/libs/fileDownload/getPhotoSource/index.android.ts @@ -0,0 +1,5 @@ +function getPhotoSource(filePath: string): string { + return `file://${filePath}`; +} + +export default getPhotoSource; diff --git a/src/libs/fileDownload/getPhotoSource/index.ts b/src/libs/fileDownload/getPhotoSource/index.ts new file mode 100644 index 000000000000..efbdeb54a063 --- /dev/null +++ b/src/libs/fileDownload/getPhotoSource/index.ts @@ -0,0 +1,5 @@ +function getPhotoSource(filePath: string): string { + return filePath; +} + +export default getPhotoSource; diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index d97df95382d6..536b8eefecb4 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -26,6 +26,7 @@ import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as FileUtils from '@libs/fileDownload/FileUtils'; +import getPhotoSource from '@libs/fileDownload/getPhotoSource'; import getCurrentPosition from '@libs/getCurrentPosition'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; @@ -446,7 +447,7 @@ function IOURequestStepScan({ }) .then((photo: PhotoFile) => { // Store the receipt on the transaction object in Onyx - const source = `${photo.path}`; + const source = getPhotoSource(photo.path); IOU.setMoneyRequestReceipt(transactionID, source, photo.path, action !== CONST.IOU.ACTION.EDIT); FileUtils.readFileAsync(source, photo.path, (file) => {