Skip to content

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

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com 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 (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. 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

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 11, 2024
  2. 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
  3. melvin-bot commented on Jan 11, 2024

    @melvin-bot
  4. melvin-bot commented on Jan 11, 2024

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 11, 2024
  6. melvin-bot commented on Jan 11, 2024

    @melvin-bot

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

  7. ikevin127 commented on Jan 13, 2024

    @ikevin127
    Contributor

    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:
    Details
        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
  8. sophiepintoraetz commented on Jan 14, 2024

    @sophiepintoraetz
    Contributor

    With @fedirjh to review the proposal

  9. 45 remaining items

  10. 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
  11. melvin-bot commented on Feb 13, 2024

    @melvin-bot

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

  12. melvin-bot commented on Feb 13, 2024

    @melvin-bot

    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:

  13. melvin-bot commented on Feb 13, 2024

    @melvin-bot

    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:
  14. isabelastisser commented on Feb 21, 2024

    @isabelastisser
    Contributor

    Hey @fedirjh please complete the checklist above. Thanks!

  15. isabelastisser commented on Feb 21, 2024

    @isabelastisser
    Contributor

    Payment summary:

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

  16. isabelastisser commented on Feb 21, 2024

    @isabelastisser
    Contributor

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

  17. fedirjh commented on Feb 21, 2024

    @fedirjh
    Contributor

    BugZero Checklist:

    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.
    
    • Do we agree 👍 or 👎
  18. isabelastisser commented on Feb 22, 2024

    @isabelastisser
    Contributor
  19. isabelastisser commented on Feb 22, 2024

    @isabelastisser
    Contributor

    All set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions