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-03-14] [$500] [MEDIUM] Smartscan: Show PDF receipt thumbnails #31432

Closed
6 tasks
trjExpensify opened this issue Nov 16, 2023 · 147 comments
Closed
6 tasks
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 Waiting for copy User facing verbiage needs polishing

Comments

@trjExpensify
Copy link
Contributor

trjExpensify commented Nov 16, 2023

Coming from here. CC: @sobitneupane @pradeepmdk @Gonals

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.3.98-5
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: @trjExpensify
Slack conversation: #30747 (comment)

Action Performed:

  1. Request Money > Scan > Upload a PDF receipt > choose a participant
  2. Observe there isn't a preview of the PDF receipt in the thumbnail on the confirmation page
  3. Click confirm to create the request
  4. Observe there isn't a preview of the PDF receipt in the thumbnail on the report preview component in the chat
  5. Click the report preview component
  6. Observe there isn't a preview of the PDF receipt in the thumbnail on the request preview component in the expense/iouReport
  7. Click the request preview component
  8. Observe there isn't a preview of the PDF receipt in the thumbnail on the receipt preview component in the request view

Expected Result:

PDF receipts should show a preview in the relevant thumbnails throughout the app.

P.s this also includes in the split preview component, so let's make sure it works there.

Actual Result:

Generic "empty" thumbnail previews are displayed for PDF receipts.

Workaround:

Yes, they can tap the thumbnail to see the PDF but they'd really not know to do that.

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

Confirmation screen:
image

Report preview on the chat:
image

Request preview on the expense/iouReport:
image

Receipt preview on the request:
image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f90fbd2f6a7c49f2
  • Upwork Job ID: 1725113274629943296
  • Last Price Increase: 2023-11-23
@trjExpensify trjExpensify 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 Nov 16, 2023
@trjExpensify trjExpensify self-assigned this Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new.

@melvin-bot melvin-bot bot changed the title [SMARTSCAN] Show PDF receipt thumbnails [$500] [SMARTSCAN] Show PDF receipt thumbnails Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

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

Copy link

melvin-bot bot commented Nov 16, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

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

@tienifr
Copy link
Contributor

tienifr commented Nov 16, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Show PDF receipt thumbnails

What is the root cause of that problem?

We're getting thumbnail for receipt here

function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string | null = null, receiptFileName: string | null = null): ThumbnailAndImageURI {

We do not have the logic to get the thumbnail of pdf

-> Default image is shown

What changes do you think we should make in order to solve the problem?

We can lean on the source to get the thumbnail for pdf.

Here's the sample source https://www.expensify.com/receipts/{id}.pdf -> the thumbnail should be https://www.expensify.com/receipts/{id}.jpg.1024.jpg

    const isReceiptPDF = Str.isPDF(filename);
...

 if(isReceiptPDF){
            return {thumbnail: `${path.substring(0, path.length-4)}.jpg.1024.jpg`, image: path};
        }

What alternative solutions did you explore? (Optional)

BE will return the thumbnail and use it to shown on FE side

Result

Screen.Recording.2023-11-16.at.18.56.52.mov

@dylanexpensify dylanexpensify changed the title [$500] [SMARTSCAN] Show PDF receipt thumbnails [$500] [SMARTSCAN] MEDIUM: Show PDF receipt thumbnails Nov 16, 2023
@melvin-bot melvin-bot bot added the Overdue label Nov 20, 2023
@trjExpensify
Copy link
Contributor Author

@0xmiroslav can you review this please? Also, @tienifr confirming in the results we're solving for all the thumbnails noted in the OP?

@melvin-bot melvin-bot bot removed the Overdue label Nov 20, 2023
@eh2077
Copy link
Contributor

eh2077 commented Nov 21, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

We want to show PDF thumbnail in the process of uploading pdf receipt.

What is the root cause of that problem?

The root cause of this issue is that, currently, we don't have an implementation of previewing PDF source by thumbnail. The PDF source here means expensify source like https://www.expensify.com/chat-attachments/7486855856104260927/w_1c2aef0dea2f6e30acd3ca31c50286af09a4d3c9.pdf or local file source starts with blob:// or file://.

Currently, uploading PDF attachment from chat can be previewed before upload and the PDF thumbnail is only available after it's been successfully uploaded and the backend will create an image source url for the PDF, like, https://www.expensify.com/chat-attachments/7486855856104260927/w_1c2aef0dea2f6e30acd3ca31c50286af09a4d3c9.jpg.1024.jpg

Intuitively, we should be able to preview the PDF thumbnail before uploading it to backend because we're able to preview PDF pages before uploading.

The new feature to have a ThumbnailPDF which works on both server and local uri like what Image component supports is great complement to the App, especially for the use case like creating an IOU request and the file is not yet been uploaded to backend and the offline use case.

What changes do you think we should make in order to solve the problem?

We can add an implementation of ThumbnailPDF which previews pdf uri (both server and local uri) in thumbnail.
On the web platform, we can refer the implementation of PDFView by only rendering the first page of PDF file as the thumbnail. We can convert the first page to image, like this example.

We can also update react-pdf to 7.x.x and then use the thumbnail feature provided. There's some extra rendering issue need to be solved if we choose to upgrade.

On native platform, we can make use of the singlePage property of https://github.com/wonday/react-native-pdf.

This solution will need more effort to implement.

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Nov 23, 2023

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

@trjExpensify
Copy link
Contributor Author

@0xmiroslav bump!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 23, 2023
@trjExpensify
Copy link
Contributor Author

Same. @0xmiroslav can you review these proposals today, please? They've been hanging out for 2 weeks.

@melvin-bot melvin-bot bot removed the Overdue label Nov 27, 2023
@0xmiros
Copy link
Contributor

0xmiros commented Nov 27, 2023

reviewing today

@trjExpensify
Copy link
Contributor Author

Perfect, thanks.

@melvin-bot melvin-bot bot added the Overdue label Nov 29, 2023
@trjExpensify
Copy link
Contributor Author

@0xmiroslav did you review? 2 weeks is a pretty long time, and PDFs are pretty common receipt types. Thanks!

@iwiznia
Copy link
Contributor

iwiznia commented Feb 27, 2024

This file type is not supported we kind of already have this:

notAllowedExtension: 'This file type is not allowed',
and this
fileUploadFailed: 'Upload failed. File is not supported.',
, should we reuse and unify those?

Invalid file type: Tipo de archivo inválido
Password-protected PDF is not supported: Los PDFs con password no son compatibles

@trjExpensify
Copy link
Contributor Author

This file type is not supported we kind of already have this:

Yeah, the idea is to replace This file type is not allowed with This file type is not supported as part of this issue now to align them.

@iwiznia
Copy link
Contributor

iwiznia commented Feb 27, 2024

ok you already have the text and translation for that

@trjExpensify
Copy link
Contributor Author

trjExpensify commented Feb 27, 2024

So for the avoidance of doubt and @eh2077 benefit, the below are the final set.

(PP-PDF specific)

Invalid file type
Password-protected PDF is not supported

Tipo de archivo inválido
Los PDFs con password no son compatibles

(Generic)

Invalid file type
This file type is not allowed

Tipo de archivo inválido
Este tipo de archivo no es compatible

@iwiznia
Copy link
Contributor

iwiznia commented Feb 27, 2024

This is wrong:

Este tipo de archivo no son compatibles

Should be:

Este tipo de archivo no es compatible

@trjExpensify
Copy link
Contributor Author

Lol, got it. Updated.

Copy link

melvin-bot bot commented Mar 6, 2024

@trjExpensify, @s77rt, @luacmartins, @CherylWalsh, @eh2077 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@s77rt
Copy link
Contributor

s77rt commented Mar 6, 2024

PR has been deployed to staging 1 hour ago

Copy link

melvin-bot bot commented Mar 7, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Mar 7, 2024
@melvin-bot melvin-bot bot changed the title [$500] [MEDIUM] Smartscan: Show PDF receipt thumbnails [HOLD for payment 2024-03-14] [$500] [MEDIUM] Smartscan: Show PDF receipt thumbnails Mar 7, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 7, 2024
Copy link

melvin-bot bot commented Mar 7, 2024

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

Copy link

melvin-bot bot commented Mar 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.48-0 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-03-14. 🎊

For reference, here are some details about the assignees on this issue:

  • @s77rt requires payment (Needs manual offer from BZ)
  • @eh2077 requires payment (Needs manual offer from BZ)

Copy link

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

  • [@s77rt / @eh2077] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt / @eh2077] 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:
  • [@s77rt / @eh2077] 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:
  • [@s77rt / @eh2077] Determine if we should create a regression test for this bug.
  • [@s77rt / @eh2077] 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.
  • [@trjExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@s77rt
Copy link
Contributor

s77rt commented Mar 8, 2024

  • The PR that introduced the bug has been identified: Not a a bug. This is a feature request
  • The offending PR has been commented on: n/a
  • A discussion in #expensify-bugs has been started: n/a
  • Determine if we should create a regression test for this bug: Yes

Regression Test Proposal

  1. Go to any chat and request money
  2. Choose Scan tab and upload a pdf file
  3. Verify that you're able to preview the PDF receipt in the confirmation page
  4. Complete the money request process
  5. Verify that you're able to preview the PDF receipt in the chat report
  6. Click on the PDF preview
  7. Verify that you're able to preview the PDF receipt in the IOU report
  8. Click on the PDF preview
  9. Verify that you're able to preview the PDF receipt in the money request report
  10. Click on the PDF preview
  11. Verify that you are displayed the PDF file

@eh2077
Copy link
Contributor

eh2077 commented Mar 12, 2024

Hi @trjExpensify

Considering the added time and complexity of completing this task, could we discuss the possibility of a bonus for me and C+ @s77rt ?

We have completed several tasks in this new feature, including displaying local PDFs, detecting password-protected PDFs, and refining translations.

It would be great to have it but it’s also fine if not :)

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 14, 2024
Copy link

melvin-bot bot commented Mar 14, 2024

Payment Summary

Upwork Job

  • C+: @s77rt paid $500 via Upwork
  • Contributor: @eh2077 paid $500 via Upwork

BugZero Checklist (@trjExpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1725113274629943296/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@trjExpensify
Copy link
Contributor Author

Hey @eh2077, thanks for the request. I agree the scope of this issue increased to encompass password-protected PDFs and updating the file type modal. I've added a bonus and sent you both offers for $750.

@s77rt
Copy link
Contributor

s77rt commented Mar 15, 2024

@trjExpensify We had a regression #37852. Should the payment here be $375 in that case?

@trjExpensify
Copy link
Contributor Author

Ah, I didn't see that. Okay cool, so then I'm fine with keeping the bounty at $500 and not reducing for that regression. Once you guys accept the offers, I'll pay a different amount. 👍

@s77rt
Copy link
Contributor

s77rt commented Mar 15, 2024

@trjExpensify Accepted! Thank you!

@melvin-bot melvin-bot bot added the Overdue label Mar 18, 2024
@trjExpensify
Copy link
Contributor Author

Paid both of you, thanks!

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 Waiting for copy User facing verbiage needs polishing
Projects
Archived in project
Development

No branches or pull requests