Skip to content
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

[HOLD for payment 2024-02-20] [$500] Android - Receipt - App crashes when downloading EReceipt from Expensify Card transaction #34348

Closed
1 of 6 tasks
kbecciv opened this issue Jan 11, 2024 · 36 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jan 11, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


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:

Action Performed:

  1. Log in to account with Expensify Card transaction ([email protected]
  2. Go to workspace chat with the transaction (https://staging.new.expensify.com/r/4612388815642526
  3. Navigate to transaction details page.
  4. Tap on the e-receipt > 3-dot menu > Download.

Expected Result:

App does not crash.

Actual Result:

App crashes.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6338794_1704974766409.Screen_Recording_20240111_113849_One_UI_Home.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c571000bd51ff4ec
  • Upwork Job ID: 1745431775064920064
  • Last Price Increase: 2024-02-01
  • Automatic offers:
    • fedirjh | Reviewer | 28142516
    • mkhutornyi | Contributor | 28142517
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 11, 2024
@melvin-bot melvin-bot bot 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 Jan 11, 2024
Copy link

melvin-bot bot commented Jan 11, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01c571000bd51ff4ec

Copy link

melvin-bot bot commented Jan 11, 2024

Triggered auto assignment to @sophiepintoraetz (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 11, 2024
Copy link

melvin-bot bot commented Jan 11, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (External)

@ikevin127
Copy link
Contributor

ikevin127 commented 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.

  1. Create a manual request.
  2. Within MoneyRequestPreview.js console log props.transaction.
  3. Tap on created request and extract transactionID from logs.
  4. Within MoneyRequestPreview.js under the first console log add the following console log replacing transactionID with the one extracted from the logs:
    console.log(Onyx.merge("transactions_transactionID", { // <- make sure to change transactionID
        cardID: 1,
        merchant: 'Google', // Random merchant
        mccGroup: 'Android', // Random group
        hasEReceipt: true,
    }));
  1. 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:

if (!isOffline) {

for when the attachment is an eReceipt in order to hide the download button on all platforms since:

the download feature for EReceipt was not implemented yet in ND.

We can check for eReceipt like so:

const isEReceipt = transaction && TransactionUtils.hasEReceipt(transaction);

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
Copy link
Contributor

With @fedirjh to review the proposal

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 14, 2024
@sophiepintoraetz
Copy link
Contributor

Bumped

@melvin-bot melvin-bot bot removed the Overdue label Jan 18, 2024
@fedirjh
Copy link
Contributor

fedirjh commented Jan 18, 2024

@kbecciv as you have this feature enabled for you, What will happen if you try to download the EReceipt on MacOS: Chrome / Safari ?

@fedirjh
Copy link
Contributor

fedirjh commented Jan 18, 2024

@ikevin127 Thank you for the proposal. The root cause analysis seems correct. However, I am unsure if we have already implemented the download feature for EReceipt. I have left some comments in the Slack thread addressing the issue. Once I receive some feedback from the team, I will review your solution. Thank you for your understanding.

@ikevin127
Copy link
Contributor

@fedirjh Sure, no worries!

For reference, this is what is happening on other platforms currently when the user tries to download an EReceipt.

  • iOS: Native - shows alert that receipt cannot be downloaded
  • Web | mWeb - opens new tab with eReceipt/{number} in url resulting in not found page
  • Desktop - opens browser url with eReceipt/{number} which can either show not found page or crash (if logged in with same account on both desktop and web)

Videos

iOS: Native
Screen.Recording.2024-01-18.at.16.21.21.mov
MacOS: Chrome / Safari
Screen.Recording.2024-01-18.at.16.14.30.mov
MacOS: Desktop
Screen.Recording.2024-01-18.at.16.23.49.mov

Copy link

melvin-bot bot commented Jan 18, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Jan 22, 2024
@sophiepintoraetz
Copy link
Contributor

Bumped @grgia for a response.

@melvin-bot melvin-bot bot removed the Overdue label Jan 23, 2024
Copy link

melvin-bot bot commented Jan 25, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Jan 25, 2024
@fedirjh
Copy link
Contributor

fedirjh commented Jan 29, 2024

cc @ikevin127 It seems that the download feature for EReceipt was not implemented yet in ND. For the crash, we should hide the download button for EReceipt. Could you please update your proposal accordingly?

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
@ikevin127
Copy link
Contributor

@fedirjh For sure, I changed the alternative solution as requested.

Updated proposal

  • changed the alternative solution according to the new information from this #34348 (comment)

Copy link

melvin-bot bot commented Feb 2, 2024

Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 5, 2024
Copy link

melvin-bot bot commented Feb 5, 2024

📣 @fedirjh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Feb 5, 2024

📣 @mkhutornyi 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot removed the Overdue label Feb 5, 2024
@isabelastisser
Copy link
Contributor

Thanks @fedirjh, I assigned @mkhutornyi.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Feb 7, 2024
@melvin-bot melvin-bot bot 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 Feb 13, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 13, 2024
Copy link

melvin-bot bot commented Feb 13, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented 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:

Copy link

melvin-bot bot commented 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:

  • [@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:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 20, 2024
@isabelastisser
Copy link
Contributor

Hey @fedirjh please complete the checklist above. Thanks!

@isabelastisser
Copy link
Contributor

Payment summary:

@fedirjh automatic offer (Reviewer) $500
@mkhutornyi automatic offer (Contributor) $500

@isabelastisser
Copy link
Contributor

The payments were processed in Upwork. Waiting for @fedirjh to complete the BZ list.

@fedirjh
Copy link
Contributor

fedirjh commented Feb 21, 2024

BugZero Checklist:

Regression Test Proposal

1. Log in to account with Expensify Card transaction : [email protected]
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.
  • Do we agree 👍 or 👎

@isabelastisser
Copy link
Contributor

@isabelastisser
Copy link
Contributor

All set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants