-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow failed image/receipt uploads to be retried #54551
base: main
Are you sure you want to change the base?
Conversation
After checking again, there is a new issue on Android Native where the "Try Again" feature causes the receipt to appear uploaded in the app but fails during the actual upload process. This likely happens because the receipt is currently stored in the I think we need to explore an alternative approach for fetching images on Android. Still looking for a possible fix Android-Native.mp4 |
@nyomanjyotisa Have you found the solution? |
Yes, the issue on Android Native has been resolved |
@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@nyomanjyotisa What about this place: Line 1533 in 1cfcfa4
action and retryParams ?
|
src/libs/actions/IOU.ts
Outdated
filename?: string, | ||
isScanRequest = true, | ||
errorKey?: number, | ||
action?: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should defined the action enum here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR updated
src/libs/actions/IOU.ts
Outdated
return isEmptyObject(receipt) || !isScanRequest | ||
? ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericCreateFailureMessage', errorKey) | ||
: ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: receipt.source?.toString() ?? '', filename: filename ?? ''}, errorKey); | ||
: ErrorUtils.getMicroSecondOnyxErrorObject( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case users manually request money within receipt, the isScanRequest
will be false, so the receipt error will not added to failureData. IMO, isEmptyObject(receipt)
is enough, but not sure why the author add !isScanRequest
check. Can you check this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, isEmptyObject(receipt)
should be enough in this case. I’m not entirely sure why that additional check was included either. If I remove the !isScanRequest
condition, this line will cause the generic error to display, resulting in a duplicate error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can you show these messages? I can't reproduce on my side
Screen.Recording.2025-01-06.at.11.18.41.mov
I think this line doesn't relate to isScanRequest
. No matter what isScanRequest
is, this error message is still added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nyomanjyotisa But I think it's expected not to show receipt error in case manual request. So we should update the test steps.
For manual request: Show the generic message
For receipt request: Show the image error message
@@ -318,6 +321,56 @@ Onyx.connect({ | |||
}, | |||
}); | |||
|
|||
type StartSplitBilActionParams = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will refactor the params in this issue so we shouldn't create the new type in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that’s the case, how would you suggest handling retryParams
in getReceiptError
without introducing a new parameter like StartSplitBillActionParams
? I believe the parameters haven’t been fully addressed in the mentioned issue yet right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you didn't introdude the new StartSplitBilActionParams
, you just moved it to other place. So it's fine
I tested the |
Correct me if I'm wrong, but I don't think |
Yah, so I think we don't need to add |
@nyomanjyotisa Some tests are failed, can you pls check? |
Sorry for the late response. The failed test has been solved @dukenv0307 |
Reviewing... |
? (JSON.parse(message.retryParams) as IOU.ReplaceReceipt | IOU.StartSplitBilActionParams | IOU.TrackExpense | IOU.RequestMoneyInformation) | ||
: message.retryParams; | ||
|
||
switch (message.action) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ACTION_PARAMS
const
<Text style={[StyleUtils.getDotIndicatorTextStyles(isErrorMessage)]}>{Localize.translateLocal('iou.error.receiptFailureMessage')}</Text> | ||
<TextLink | ||
style={[StyleUtils.getDotIndicatorTextStyles(), styles.link]} | ||
onPress={() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pls define the new function for it (instead of anonymous func) ?
@nyomanjyotisa Pls let me know when it's ready for review. Thanks |
@nyomanjyotisa friendly bump |
The PR has been updated. Could you please review it again, @dukenv0307? |
For handleRetryPress function, we should define it in |
|
undefined, | ||
undefined, | ||
undefined, | ||
policyTagList: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove undefined value
translate('iou.fieldPending'), | ||
currentUserPersonalDetails.login, | ||
currentUserPersonalDetails.accountID, | ||
amount: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use default value in trackExpense
, then remove the unnecessary value here
Pls refactor the trackExpense function call |
@nyomanjyotisa Any updates? |
@nyomanjyotisa bump |
Working on this today |
PR updated @dukenv0307 |
import useStyleUtils from '@hooks/useStyleUtils'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import {isReceiptError} from '@libs/ErrorUtils'; | ||
import fileDownload from '@libs/fileDownload'; | ||
import * as Localize from '@libs/Localize'; | ||
import {translateLocal} from '@libs/Localize'; | ||
import handleRetryPress from '@libs/ReceiptUploadRetryHandler/index'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import handleRetryPress from '@libs/ReceiptUploadRetryHandler/index'; | |
import handleRetryPress from '@libs/ReceiptUploadRetryHandler'; |
Explanation of Change
Fixed Issues
$ #50507
PROPOSAL: #50507 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Test 1 (Replace Receipt):
Test 2 (Split expense):
Test 3 (Track expense):
Test 4 (Request Money - Scan):
Test 5 (Request Money - Manual):
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android-Native.mp4
Android: mWeb Chrome
Android-mWeb.Chrome.mp4
iOS: Native
iOS-Native.mp4
iOS: mWeb Safari
iOS-mWeb.Safari.mp4
MacOS: Chrome / Safari
MacOS-Chrome.mp4
MacOS: Desktop
MacOS-Desktop.mp4