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-06-13] [$250] Android - Receipt - Receipt view is inconsistent in mweb&Android #40788

Closed
1 of 6 tasks
lanitochka17 opened this issue Apr 23, 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 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Apr 23, 2024

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: 1.4.64
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4504759
**Issue reported by:**Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
    / launch app
  2. Tap on Workspace chat
  3. Tap plus icon -- submit expense
  4. Submit an expense with below receipt attached
  5. Open the expense and tap on the receipt

Expected Result:

Receipt view must not be inconsistent in mweb and Android

Actual Result:

Receipt is shown smaller in mweb and bigger in Android

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

Bug6458565_1713864324858.revghj.mp4

Bug6458565_1713864324852!w_6918299a5fd0b2469173078141943060da451901-2024-04-23_08_13_13 352

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a54a18910078b715
  • Upwork Job ID: 1783190710289416192
  • Last Price Increase: 2024-05-08
  • Automatic offers:
    • samilabud | Contributor | 0
Issue OwnerCurrent Issue Owner: @CortneyOfstad
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 23, 2024
Copy link

melvin-bot bot commented Apr 23, 2024

Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@CortneyOfstad FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@CortneyOfstad CortneyOfstad added the External Added to denote the issue can be worked on by a contributor label Apr 24, 2024
Copy link

melvin-bot bot commented Apr 24, 2024

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

@melvin-bot melvin-bot bot changed the title Android - Receipt - Receipt view is inconsistent in mweb&Android [$250] Android - Receipt - Receipt view is inconsistent in mweb&Android Apr 24, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 24, 2024
Copy link

melvin-bot bot commented Apr 24, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Apr 26, 2024
@samilabud
Copy link
Contributor

samilabud commented Apr 26, 2024

Proposal

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

Android receipts are displayed as the same size of the canvas size

What is the root cause of that problem?

We are using the MultigestureCanvas to display the image/receipt, this component always try to fit the image to the content, this works perfectly for image that are bigger than the canvas size but when the image is lower than the canvas we can notice this issue. This is because we are getting the min scale of the image like below:

const getCanvasFitScale: GetCanvasFitScale = ({canvasSize, contentSize}) => {
const scaleX = canvasSize.width / contentSize.width;
const scaleY = canvasSize.height / contentSize.height;
const minScale = Math.min(scaleX, scaleY);
const maxScale = Math.max(scaleX, scaleY);
return {scaleX, scaleY, minScale, maxScale};
};

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

We should verify if we need to use the scale to fit the canvas size before we try to fit the image in getCanvasFitScale, and if the image not need to be resized we should use the same image size like:

type ShouldResizeToFit = (canvasSize: CanvasSize, contentSize: ContentSize) => boolean;
type GetCanvasFitScale = (props: {canvasSize: CanvasSize; contentSize: ContentSize}) => {scaleX: number; scaleY: number; minScale: number; maxScale: number};

const shouldResizeToFit: ShouldResizeToFit = (canvasSize, contentSize) => {
    // If the image is smaller than canvas should no fit to canvas scale
    if (canvasSize && contentSize) {
        return canvasSize.width < contentSize.width || canvasSize.height < contentSize.height;
    }
    return false;
};

const getCanvasFitScale: GetCanvasFitScale = ({canvasSize, contentSize}) => {
    const shouldResize = shouldResizeToFit(canvasSize, contentSize);

    const scaleX = canvasSize.width / contentSize.width;
    const scaleY = canvasSize.height / contentSize.height;

    const minScale = !shouldResize ? 1 : Math.min(scaleX, scaleY);
    const maxScale = Math.max(scaleX, scaleY);

    return {scaleX, scaleY, minScale, maxScale};
};
Testing the change:
Android.-.Receipt.-.Receipt.view.is.inconsistent.-.test.mov

@CortneyOfstad
Copy link
Contributor

@eVoloshchak any thoughts on the proposal above?

@melvin-bot melvin-bot bot removed the Overdue label Apr 29, 2024
@eVoloshchak
Copy link
Contributor

@samilabud, thank you for the proposal!
Unfortunately, it breaks the layout of bigger images (i.e. if the image resolution is bigger than the screen resolution, it isn't resized to fit)

Screen.Recording.2024-05-01.at.14.22.45.mov

@samilabud
Copy link
Contributor

@samilabud, thank you for the proposal! Unfortunately, it breaks the layout of bigger images (i.e. if the image resolution is bigger than the screen resolution, it isn't resized to fit)

Screen.Recording.2024-05-01.at.14.22.45.mov

Oh you were right, I have updated my proposal with a new video and added a function to determinate if we should resize the image to fit the canvas size, please let me know if it looks good to you 🙏🏼

Copy link

melvin-bot bot commented May 1, 2024

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

@CortneyOfstad
Copy link
Contributor

Thanks @samilabud!

CC @eVoloshchak 👍

@melvin-bot melvin-bot bot added the Overdue label May 3, 2024
@eVoloshchak
Copy link
Contributor

@samilabud, I still think this is more of a workaround than an actual fix of the root cause, let's try to dig a bit deeper.
Why is passing correct content size as contentSize results in image being displayed incorrectly? Is this something that could be fixed inside of the MultiGestureCanvas itself?

@melvin-bot melvin-bot bot removed the Overdue label May 6, 2024
Copy link

melvin-bot bot commented May 7, 2024

@eVoloshchak @CortneyOfstad this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@samilabud
Copy link
Contributor

Is this something that could be fixed inside of the MultiGestureCanvas itself?
Hi @eVoloshchak, please see my alternative proposal, and thanks for the suggestions it makes more sense!

Proposal

Updated

Copy link

melvin-bot bot commented May 7, 2024

@eVoloshchak @CortneyOfstad this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented May 8, 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 May 8, 2024
@CortneyOfstad
Copy link
Contributor

@eVoloshchak it looks like we have an updated proposal here. Can you take a look when you have a chance? Thanks!

@melvin-bot melvin-bot bot removed the Overdue label May 8, 2024
@CortneyOfstad
Copy link
Contributor

@eVoloshchak just bumping for feedback on the proposal above — thanks!

Copy link

melvin-bot bot commented May 14, 2024

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

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

melvin-bot bot commented May 14, 2024

📣 @samilabud 🎉 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 📖

@CortneyOfstad
Copy link
Contributor

@eVoloshchak any update on the PR review? Thanks!

@CortneyOfstad
Copy link
Contributor

Merge freeze until Wednesday so PR will be addressed then!

@CortneyOfstad
Copy link
Contributor

Merge freeze is planned to end today 🤞

Copy link

melvin-bot bot commented Jun 5, 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 Weekly KSv2 labels Jun 6, 2024
@melvin-bot melvin-bot bot changed the title [$250] Android - Receipt - Receipt view is inconsistent in mweb&Android [HOLD for payment 2024-06-13] [$250] Android - Receipt - Receipt view is inconsistent in mweb&Android Jun 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 6, 2024
Copy link

melvin-bot bot commented Jun 6, 2024

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

Copy link

melvin-bot bot commented Jun 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.79-11 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-06-13. 🎊

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

Copy link

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

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

@CortneyOfstad
Copy link
Contributor

@eVoloshchak can you have the checklist as soon as you have a chance? Just want to make sure there is no delays in issuing payments. Thank you!

@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Feature: Use attachment gallery everywhere #31308
  • 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: https://github.com/Expensify/App/pull/31308/files#r1635384531
  • 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: I don't think a discussion is needed
  • Determine if we should create a regression test for this bug.
    Is it easy to test for this bug? Yes
    Is the bug related to an important user flow? Yes
    Is it an impactful bug? No

Regression Test Proposal

  1. Open any chat
  2. Tap Composer plus icon -> submit expense
  3. Submit an expense with this receipt image attached
  4. Open the expense and tap on the receipt
  5. Verify the image is displayed correctly, zoom-in/out and pagination work correctly

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 12, 2024
@CortneyOfstad
Copy link
Contributor

@CortneyOfstad
Copy link
Contributor

Payment Summary

@samilabud — paid $250 via Upwork
@eVoloshchak — to be paid $250 via NewDot

@JmillsExpensify
Copy link

$250 approved for @eVoloshchak

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 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

6 participants