You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-02-20] [$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction #34348
Version Number: v1.4.24-3 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
changed the title [-]Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/-][+][$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/+]on Jan 11, 2024
Please re-state the problem that we are trying to solve in this issue
App crashes when downloading EReceipt from Expensify Card transaction.
Instructions to reproduce issue on local development
This will add an EReceipt Card locally in Onyx.
Create a manual request.
Within MoneyRequestPreview.js console log props.transaction.
Tap on created request and extract transactionID from logs.
Within MoneyRequestPreview.js under the first console log add the following console log replacing transactionID with the one extracted from the logs:
Details
console.log(Onyx.merge("transactions_transactionID",{// <- make sure to change transactionIDcardID: 1,merchant: 'Google',// Random merchantmccGroup: 'Android',// Random grouphasEReceipt: true,}));
Now when re-visiting the created manual request this will have an EReceipt Card attached
Note: keep the step 4 console log within the code because if removed the EReceipt won't persist due to transaction re-fetching when navigating.
What is the root cause of that problem?
The crash happens because the source url we're trying to download has the following form: eReceipt/3792612540331572334 because it's an EReceipt component created by us within the app and doesn't have a HTTP/HTTPS url source, therefore the download errors with: Can only download HTTP/HTTPS URIs which crashes the app.
What changes do you think we should make in order to solve the problem?
Using a package we already use called react-native-view-shot we can pass down a ref to the EReceipt component and capture it as an image which we can then save to the device camera roll upon downloading.
Pseudo code:
within AttachmentModal.js create new ref called eReceiptViewRef
pass down ref to AttachmentView then once more to EReceipt's the wrapping View
back in AttachmentModal.js above the downloadAttachment function define isEReceipt constant like so: !_.isEmpty(props.transaction) && TransactionUtils.hasEReceipt(props.transaction)
inside the downloadAttachment function after if (isAuthTokenRequired) add if (isEReceipt)
within the isEReceipt if we use react-native-view-shot's captureRef function to capture the EReceipt, save it to the camera roll then display an alert that notices the user that the attachment was saved to camera roll
What alternative solutions did you explore? (Optional)
As per #34348 (comment), as an alternative to fixing this issue we should hide the download button for EReceipt attachments by adding an additional check in the line:
changed the title [-][$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/-][+][HOLD for payment 2024-02-20] [$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/+]on Feb 13, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.40-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
[@fedirjh] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@fedirjh] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@fedirjh] Determine if we should create a regression test for this bug.
[@fedirjh] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Link to discussion: N/A Nothing to add to the checklist.
Determine if we should create a regression test for this bug: Yes
Regression Test Proposal
1. Log in to account with Expensify Card transaction : tester@applausecard.expensifail.com
2. Go to workspace chat with the transaction https://staging.new.expensify.com/r/4612388815642526
3. Navigate to transaction details page.
4. Open receipt preview
5. Verify that download icon doesn't show. If three dots menu exists, verify that it doesn't contain download icon option.
Activity
[-]Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/-][+][$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/+]melvin-bot commentedon Jan 11, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01c571000bd51ff4ec
melvin-bot commentedon Jan 11, 2024
Triggered auto assignment to @sophiepintoraetz (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jan 11, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (
External)ikevin127 commentedon Jan 13, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue
App crashes when downloading EReceipt from Expensify Card transaction.
Instructions to reproduce issue on local development
This will add an EReceipt Card locally in Onyx.
MoneyRequestPreview.jsconsole logprops.transaction.transactionIDfrom logs.MoneyRequestPreview.jsunder the first console log add the following console log replacingtransactionIDwith the one extracted from the logs:Details
Note: keep the step 4 console log within the code because if removed the EReceipt won't persist due to transaction re-fetching when navigating.
What is the root cause of that problem?
The crash happens because the source url we're trying to download has the following form:
eReceipt/3792612540331572334because it's an EReceipt component created by us within the app and doesn't have a HTTP/HTTPS url source, therefore the download errors with: Can only download HTTP/HTTPS URIs which crashes the app.What changes do you think we should make in order to solve the problem?
Using a package we already use called
react-native-view-shotwe can pass down a ref to the EReceipt component and capture it as an image which we can then save to the device camera roll upon downloading.Pseudo code:
isEReceiptconstant like so:!_.isEmpty(props.transaction) && TransactionUtils.hasEReceipt(props.transaction)captureReffunction to capture the EReceipt, save it to the camera roll then display an alert that notices the user that the attachment was saved to camera rollWhat alternative solutions did you explore? (Optional)
As per #34348 (comment), as an alternative to fixing this issue we should hide the download button for EReceipt attachments by adding an additional check in the line:
App/src/components/AttachmentModal.js
Line 420 in 045a0d0
for when the attachment is an eReceipt in order to hide the download button on all platforms since:
We can check for eReceipt like so:
App/src/components/ReportActionItem/ReportActionItemImage.tsx
Line 49 in 0ead105
Videos
iOS: Native
Screen.Recording.2024-01-13.at.03.39.14.mov
Android: Native
Screen.Recording.2024-01-13.at.02.56.48.mov
MacOS: Chrome / Safari
Screen.Recording.2024-01-16.at.18.39.55.mov
MacOS: Desktop
Screen.Recording.2024-01-16.at.18.46.12.mov
sophiepintoraetz commentedon Jan 14, 2024
With @fedirjh to review the proposal
45 remaining items
[-][$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/-][+][HOLD for payment 2024-02-20] [$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction[/+]melvin-bot commentedon Feb 13, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Feb 13, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.40-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-02-20. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Feb 13, 2024
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
isabelastisser commentedon Feb 21, 2024
Hey @fedirjh please complete the checklist above. Thanks!
isabelastisser commentedon Feb 21, 2024
Payment summary:
@fedirjh automatic offer (Reviewer) $500
@mkhutornyi automatic offer (Contributor) $500
isabelastisser commentedon Feb 21, 2024
The payments were processed in Upwork. Waiting for @fedirjh to complete the BZ list.
fedirjh commentedon Feb 21, 2024
BugZero Checklist:
Regression Test Proposal
isabelastisser commentedon Feb 22, 2024
Regression test:
https://github.com/Expensify/Expensify/issues/371827
isabelastisser commentedon Feb 22, 2024
All set.