Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.4k stars 2.79k forks source link

[waiting for payment][$250] Share code- QR code expands to full size after opening for WS rooms, tasks and threads #44436

Closed izarutskaya closed 1 month ago

izarutskaya commented 3 months ago

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: 9.0.2-0 Reproducible in staging?: Y Reproducible in production?: N If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4675372 Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team

Action Performed:

  1. Open the app and log in
  2. Navigate to any task, thread or a workspace room
  3. Tap the header and select Share

Expected Result:

The QR code is displayed fully

Actual Result:

The QR code is displayed small briefly and expands to the full size

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/Expensify/App/assets/115492554/91c91457-a976-4e4d-a368-05544fcacbb0

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e0a4dbc404a8ab34
  • Upwork Job ID: 1805949354249394574
  • Last Price Increase: 2024-07-10
  • Automatic offers:
    • alitoshmatov | Reviewer | 103091801
    • huult | Contributor | 103091804
Issue OwnerCurrent Issue Owner: @adelekennedy
melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @adelekennedy (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.

melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @danieldoglas (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

github-actions[bot] commented 3 months ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
izarutskaya commented 3 months ago

@adelekennedy 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.

izarutskaya commented 3 months ago

We think this issue might be related to the #vip-vsb

huult commented 3 months ago

Proposal

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

QRCode change size after layout change

What is the root cause of that problem?

Default QR code size is 120px, after layout change the QR code recalculate size at this line

https://github.com/Expensify/App/blob/224f09edbb511bd179d79c55f646d5522c1f955d/src/components/QRShare/index.tsx#L32

so the UI QRCode will update width and height

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

We have to set the default initial height for qrcode size at this line base on platform

https://github.com/Expensify/App/blob/224f09edbb511bd179d79c55f646d5522c1f955d/src/components/QRShare/index.tsx#L19

ST like that

+    const isMobilePlatform = Platform.OS === 'android' || Platform.OS === 'ios';
+    const isMobileBrowser = Browser.isMobile();
+    const isMobile = isMobilePlatform || isMobileBrowser;
+    const { windowWidth } = useWindowDimensions();
+.   const qrShareContainerWidth = isMobile ? windowWidth : variables.sideBarWidth;

-     const [qrCodeSize, setQrCodeSize] = useState<number | undefined>();
+    // styles.ph5.paddingHorizontal * 2: This is the padding outside of the QR code.
+    // variables.qrShareHorizontalPadding * 2: This is the padding inside of the QR code.
+    // default size is remaining width after minus padding from parent container
+    const [qrCodeSize, setQrCodeSize] = useState<number>(
+        qrShareContainerWidth - (styles.ph5.paddingHorizontal * 2) - (variables.qrShareHorizontalPadding * 2)
+    );
POC https://github.com/Expensify/App/assets/20178761/9856157d-14d2-4d24-9077-16e8cfc5fb51

What alternative solutions did you explore? (Optional)

Sparth19 commented 3 months ago

Proposal

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

What is the root cause of that problem?

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

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

@danieldoglas, @alitoshmatov, @adelekennedy Huh... This is 4 days overdue. Who can take care of this?

alitoshmatov commented 3 months ago

Thank you for your proposal @huult. This issue is also happening on ios app. So I don't think writing platform specific code is a good idea

alitoshmatov commented 3 months ago

Thank you for your proposal @Sparth19 , QR codes are readily available data showing loader just for fixing its layout seems a workaround

huult commented 3 months ago

@alitoshmatov My proposal is not focused on Android only, so I wrote a note below the code: ! we have to separate to specific platform and calculate based on that. My proposal covers both Android and iOS by applying index.native.ts because mobile uses a fixed size, while the web uses the responsive size

melvin-bot[bot] commented 3 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

huult commented 2 months ago

Proposal updated

Thank you for your proposal @huult. This issue is also happening on ios app. So I don't think writing platform specific code is a good idea

Hi @alitoshmatov , I have updated some proposals and explained why we used them. Can you check it again? Thank you.

For mobile devices, the screen width is fixed. We can get the device width using Dimensions.get('screen').width, and then calculate the QR code size based on this container's padding.

For other devices, we use a fixed sidebar width of 375px, and we can calculate the initial QR code size based on this width

Here is test branch

alitoshmatov commented 2 months ago

Most of the time onLayout function working in an instant, I guess it is an issue only in slower devices.

@truph01 We cannot use Dimensions.get directly, there is a useWindowDimensions hook for that. For your solution to be viable, we should prove that that window width is always equal to event.nativeEvent.layout.width to prevent size changes

huult commented 2 months ago

Proposal Updated

@truph01 We cannot use Dimensions.get directly, there is a useWindowDimensions hook for that. For your solution to be viable, we should prove that that window width is always equal to event.nativeEvent.layout.width to prevent size changes

@alitoshmatov I used the useWindowDimensions hook instead of directly using Dimensions.get to prevent size changes. Thank you.

Here is test branch

dominictb commented 2 months ago

Proposal

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

What is the root cause of that problem?

  1. Then, when we use QRShare, directly pass the initialQrCodeSize value. For example, this: https://github.com/Expensify/App/blob/224f09edbb511bd179d79c55f646d5522c1f955d/src/pages/ShareCodePage.tsx#L83 should be:
                    <QRShare
                        initialQrCodeSize={initialQrCodeSize}

    with:

    const {isSmallScreenWidth} = useResponsiveLayout();
    const {windowWidth} = useWindowDimensions();
    const initialQrCodeSize = (isSmallScreenWidth ? windowWidth : variables.sideBarWidth) - themeStyles.ph5.paddingHorizontal * 2 - variables.qrShareHorizontalPadding * 2;

and this: https://github.com/Expensify/App/blob/224f09edbb511bd179d79c55f646d5522c1f955d/src/pages/workspace/WorkspaceProfileSharePage.tsx#L59 should be:

                    <QRShare
                        initialQrCodeSize={initialQrCodeSize}

with:

    const {isSmallScreenWidth} = useResponsiveLayout();
    const {windowWidth} = useWindowDimensions();
    const initialQrCodeSize = (isSmallScreenWidth ? windowWidth : variables.sideBarWidth) - themeStyles.ph9.paddingHorizontal * 2 - variables.qrShareHorizontalPadding * 2;

Note:

huult commented 2 months ago

@alitoshmatov I think this proposal duplicates my proposal. It still uses the initial container width to calculate the QR size after removing padding.

dominictb commented 2 months ago

@alitoshmatov My proposal ensures the QRCode size is dynamically determined based on its container. If we decide to fix the QRCode size in the future, how should we handle scenarios where the QRShare needs to adapt to different View component widths?

danieldoglas commented 2 months ago

friendly bump @alitoshmatov

melvin-bot[bot] commented 2 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] commented 2 months ago

@danieldoglas @alitoshmatov @adelekennedy 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!

melvin-bot[bot] commented 2 months ago

@danieldoglas, @alitoshmatov, @adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

alitoshmatov commented 2 months ago

@huult Although @dominictb 's proposal looks similar to yours(even maybe inspired by yours), I do think they made a much needed improvement here. Calculating and passing qr code width in parent container and using isSmallScreenWidth rather then platform specific code is substantial difference in my opinion.

truph01 commented 2 months ago

@alitoshmatov Sorry, any mistake here? I see you tagged me in this issue.

alitoshmatov commented 2 months ago

Sorry for inconvenience, @truph01 Right, I didn't mean to. Yes you can ignore this

alitoshmatov commented 2 months ago

I think we can go with @dominictb 's proposal which is similar to or even derived from @huult 's proposal.

I am not sure about my judgement here, if we look on each proposal separately, @dominictb 's proposal would definitely be the one. But considering @huult was working on their proposal and giving much needed direction I am in doubt here. Would love to hear your take on this one @danieldoglas

C+ reviewed πŸŽ€ πŸ‘€ πŸŽ€

melvin-bot[bot] commented 2 months ago

Current assignee @danieldoglas is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

huult commented 2 months ago

@alitoshmatov @danieldoglas My proposal will be provided as soon as possible and will still cover the issue. RegardingisSmallScreenWidth orisMobile, these are condition checks to detect the container if they want to cover the screen size of other devices, which can be updated during code review or while creating a pull request. As I checked the contributor rules and found item 6 of proposal for the job then other proposal should diferent MUST BE DIFFERENT FROM EXISTING PROPOSALS. The difference should be important, meaningful or considerable. If other proposal not used inital container with after remove padding to resolve this issue then it's ok.

danieldoglas commented 2 months ago

OK, I think we'll go with @huult's proposal. I agree that there are some differences between them, but I think @dominictb's proposal derived from the @huult's and we can address the smaller changes in the PR.

melvin-bot[bot] commented 2 months ago

πŸ“£ @alitoshmatov πŸŽ‰ 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

melvin-bot[bot] commented 2 months ago

πŸ“£ @huult πŸŽ‰ 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 πŸ“–

dominictb commented 2 months ago

@danieldoglas

danieldoglas commented 2 months ago

Assigning @mountiny to see the end of this while I'm OOO

mountiny commented 2 months ago

@dominictb I understand your concern, and I am sorry that this time, it did not work out. I think both of you and your solutions will work, and they are similar, so @huult should go ahead, as their proposal came in first.

@huult what is your ETA for the PR?

huult commented 2 months ago

I will create the pull requests soon. The ETA is the next day. Thank you.

dominictb commented 2 months ago

@mountiny @danieldoglas Thanks for your answer

huult commented 2 months ago

here is my PR

huult commented 2 months ago

Hi @mountiny , @danieldoglas , My PR was merged to production a week ago, but I noticed the Mevin bot isn't working as expected compared to other tickets I've worked on. Can I ask if this ticket is currently able to process a payment? Thank you!

adelekennedy commented 2 months ago

ty @danieldoglas let me handle payment now:

Payouts due:

Upwork job is here.

adelekennedy commented 2 months ago

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 @alitoshmatov

adelekennedy commented 1 month ago

@alitoshmatov checklist above when you get a chance!

alitoshmatov commented 1 month ago

Regression Test Proposal

  1. Open the app and log in.
  2. Navigate to any task, thread, or workspace room.
  3. Tap the header to open the details and select "Share".
  4. Verify that the QR code is displayed in full size and not changing its size while page is opening.

Do we agree πŸ‘ or πŸ‘Ž

cc: @adelekennedy