App icon indicating copy to clipboard operation
App copied to clipboard

Prevent going back to participant page when categorizing

Open nkdengineer opened this issue 1 year ago • 30 comments

Explanation of Change

Prevent going back to participant page when categorizing

Fixed Issues

$ https://github.com/Expensify/App/issues/53274 https://github.com/Expensify/App/issues/53318 PROPOSAL:

Tests

  • https://github.com/Expensify/App/issues/53274
  1. Login with a new account
  2. Create two new workspaces
  3. Create a track expense
  4. Categorize it
  5. Select a category
  6. On the confirmation page, click on the back button
  7. Verify that the category page is displayed
  • https://github.com/Expensify/App/issues/53318 (only Android/IOS app)

Precondition:

  • Device font size should be small.
  • Account has no workspace.
  1. Create a track expense
  2. Categorize it
  3. On the upgrade page, click on the upgrade button
  4. Verify that the success message is center-aligned
  • [x] Verify that no errors appear in the JS console

Offline tests

Same

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • https://github.com/Expensify/App/issues/53274
  1. Login with a new account
  2. Create two new workspaces
  3. Create a track expense
  4. Categorize it
  5. Select a category
  6. On the confirmation page, click on the back button
  7. Verify that the category page is displayed
  • https://github.com/Expensify/App/issues/53318 (only Android/IOS app)

Precondition:

  • Device font size should be small.
  • Account has no workspace.
  1. Create a track expense
  2. Categorize it
  3. On the upgrade page, click on the upgrade button
  4. Verify that the success message is center-aligned
  • [x] Verify that no errors appear in the JS console

PR Author Checklist

  • [x] I linked the correct issue in the ### Fixed Issues section above
  • [x] I wrote clear testing steps that cover the changes made in this PR
    • [x] I added steps for local testing in the Tests section
    • [x] I added steps for the expected offline behavior in the Offline steps section
    • [x] I added steps for Staging and/or Production testing in the QA steps section
    • [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • [x] I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • [x] I included screenshots or videos for tests on all platforms
  • [x] I ran the tests on all platforms & verified they passed on:
    • [x] Android: Native
    • [x] Android: mWeb Chrome
    • [x] iOS: Native
    • [x] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [x] MacOS: Desktop
  • [x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • [x] I followed proper code patterns (see Reviewing the code)
    • [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • [x] I verified that comments were added to code that is not self explanatory
    • [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • [x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • [x] If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • [x] I verified the JSDocs style guidelines (in STYLE.md) were followed
  • [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • [x] I followed the guidelines as stated in the Review Guidelines
  • [x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • [x] I verified that if a function's arguments changed that all usages have also been updated correctly
  • [x] If any new file was added I verified that:
    • [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • [x] If a new CSS style is added I verified that:
    • [x] A similar style doesn't already exist
    • [x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • [x] I verified that all the inputs inside a form are aligned with each other.
    • [x] I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • [x] If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • [x] I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • [x] If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

https://github.com/user-attachments/assets/9171fcd0-e17c-4d36-b5a6-e42b3b61da98

Screenshot 2024-12-03 at 11 33 31
Android: mWeb Chrome

https://github.com/user-attachments/assets/ca788ce7-c6d6-4ea2-996d-7075b73a2591

iOS: Native

https://github.com/user-attachments/assets/3bb345d3-e85a-4ce4-8e18-8d054e48d6cf

Screenshot 2024-12-03 at 11 31 55
iOS: mWeb Safari

https://github.com/user-attachments/assets/247cac59-14e1-4306-bd68-2eee2c1132da

MacOS: Chrome / Safari

https://github.com/user-attachments/assets/09b30572-4f0b-4ba8-a5ac-b2ee188fe881

MacOS: Desktop

https://github.com/user-attachments/assets/fb463fc8-0424-426a-86dd-a4c70666f3d4

nkdengineer avatar Dec 03 '24 04:12 nkdengineer

@Ollyws Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

melvin-bot[bot] avatar Dec 03 '24 04:12 melvin-bot[bot]

Wouldn't it make more sense that pressing back here takes us back to the category select page?

Ollyws avatar Dec 03 '24 12:12 Ollyws

@trjExpensify What do you think?

nkdengineer avatar Dec 03 '24 13:12 nkdengineer

Yes, that's what I would expect. If you go back from the category list, then we close the RHP and NOT show a workspace list.

trjExpensify avatar Dec 03 '24 15:12 trjExpensify

@Ollyws All good now.

nkdengineer avatar Dec 03 '24 15:12 nkdengineer

Yes, that's what I would expect. If you go back from the category list, then we close the RHP and NOT show a workspace list.

This is working fine when we're going back from the category list, but when we go back from the submit page it closes the panel instead of going back to the category list:

https://github.com/user-attachments/assets/141e19ea-6019-4ef2-9a5e-e72fc8d8fe98

Ollyws avatar Dec 03 '24 16:12 Ollyws

Right, I agree if you go back from the confirmation page it should take you to the category list. If you go back from the category list, it closes the RHP.

trjExpensify avatar Dec 04 '24 01:12 trjExpensify

@Ollyws When we are from the category step we always closeAndNavigate to the confirmation step. Then I think it's good to close the RHP in confirmation in this case because if in the confirmation step we click on category item to open the category step and click the back button two times, it also closes the RHP.

https://github.com/Expensify/App/blob/ce282d38777e9e0a267e1b6f44bff9c4aace98ee/src/pages/iou/request/step/IOURequestStepCategory.tsx#L130-L133

cc @trjExpensify

https://github.com/user-attachments/assets/15a36556-bd04-4131-96e4-8e277e2bf533

nkdengineer avatar Dec 04 '24 05:12 nkdengineer

What's your opinion on the behaviour in this video @trjExpensify ?

Ollyws avatar Dec 05 '24 16:12 Ollyws

Yeah, my expectation was:

  1. Click "categorize it"
  2. Upgrade to a workspace to unlock categories
  3. Choose a category
  4. Land on the confirmation page
  5. Go back
  6. Choose a category
  7. Go back
  8. Close the RHP

Whereas, what appears to be happening is:

  1. Click "categorize it"
  2. Upgrade to a workspace to unlock categories
  3. Choose a category
  4. Land on the confirmation page
  5. Go back
  6. Close the RHP

I prefer the first, but I'm not super passionate. Is @nkdengineer basically saying that because this is the same category selector on the confirmation page, we don't navigate back to it when you go back from there ordinarily. CC: @luacmartins @mountiny if you have any strong opinions on this.

trjExpensify avatar Dec 05 '24 19:12 trjExpensify

I agree that the first option @trjExpensify laid out is better.

luacmartins avatar Dec 05 '24 22:12 luacmartins

Same as Tom and Carlos

@nkdengineer Can you please update the PR based on that expected outcome? thanks!

mountiny avatar Dec 09 '24 00:12 mountiny

I updated with this approach. However, I noticed that the animation is different when we click on the category section of the confirmation page for the first time.

@trjExpensify cc @mountiny @Ollyws

https://github.com/user-attachments/assets/ce12511d-0311-45b1-a4b5-c297ab01735f

nkdengineer avatar Dec 09 '24 09:12 nkdengineer

@nkdengineer That is not right, we should be pushing that screen in.

mountiny avatar Dec 09 '24 10:12 mountiny

@mountiny Currently, we're using closeAndNavigate then this bug will not happen.

https://github.com/Expensify/App/blob/37105a1b4c60ba6416b3ae3415c2265a53c55257/src/pages/iou/request/step/IOURequestStepCategory.tsx#L131

But we need to use navigate instead because we want this behavior.

After that when we navigate to this screen, the animation is wrong because the screen is existed https://github.com/Expensify/App/blob/37105a1b4c60ba6416b3ae3415c2265a53c55257/src/components/MoneyRequestConfirmationListFooter.tsx#L432

nkdengineer avatar Dec 09 '24 11:12 nkdengineer

I feel like there must be a way to achieve this @adamgrzybowski @WojtekBoman in case you have an idea on how to achieve this flow in the RHP

Yeah, my expectation was:

  1. Click "categorize it"
  2. Upgrade to a workspace to unlock categories
  3. Choose a category
  4. Land on the confirmation page
  5. Go back
  6. Choose a category
  7. Go back
  8. Close the RHP

mountiny avatar Dec 09 '24 11:12 mountiny

@mountiny @trjExpensify @nkdengineer

I'd like to make sure. Is this what we want to achieve?

https://github.com/user-attachments/assets/e394a289-5b9d-40b9-900c-9d16f4a56053

WojtekBoman avatar Dec 09 '24 12:12 WojtekBoman

@WojtekBoman @adamgrzybowski That looks good for the flow once you already upgraded to workspace. I guess its harder when the user does not have a workspace yet and then by categorizing it, we need to create a workspace

mountiny avatar Dec 09 '24 13:12 mountiny

I guess its harder when the user does not have a workspace yet and then by categorizing it, we need to create a workspace

They go through an upgrade interstitial. Confirming on that page (before seeing the category list) is what creates the workspace.

trjExpensify avatar Dec 09 '24 13:12 trjExpensify

https://github.com/user-attachments/assets/a8980d33-813e-40c6-b1f3-fe5494411f59

After upgrading the workspace, categorizing flow is opened and works the same way as on the previous video that I attached

WojtekBoman avatar Dec 09 '24 16:12 WojtekBoman

That looks like what we're after.

trjExpensify avatar Dec 09 '24 16:12 trjExpensify

@WojtekBoman nice! What changes have you made?

mountiny avatar Dec 09 '24 16:12 mountiny

https://github.com/Expensify/App/blob/37105a1b4c60ba6416b3ae3415c2265a53c55257/src/components/MoneyRequestConfirmationListFooter.tsx#L432

Here, I added CONST.NAVIGATION.ACTION_TYPE.PUSH as the second param of Navigation.navigate

WojtekBoman avatar Dec 09 '24 17:12 WojtekBoman

I only added the two changes I mentioned above, but I'm not very familiar with the categorization flow, so it's possible I missed something

WojtekBoman avatar Dec 09 '24 17:12 WojtekBoman

Thank you! @nkdengineer can you please check these out?

mountiny avatar Dec 09 '24 17:12 mountiny

Thanks, @WojtekBoman. @mountiny I updated the code and the test steps.

nkdengineer avatar Dec 09 '24 17:12 nkdengineer

Thanks! @Ollyws what is your ETA for the review?

mountiny avatar Dec 10 '24 12:12 mountiny

🚧 @mountiny has triggered a test build. You can view the workflow run here.

github-actions[bot] avatar Dec 10 '24 12:12 github-actions[bot]

@mountiny Will get to this one later today.

Ollyws avatar Dec 10 '24 12:12 Ollyws

:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:

Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/53420/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/53420/index.html
Android iOS
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/53420/NewExpensify.dmg https://53420.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

github-actions[bot] avatar Dec 10 '24 12:12 github-actions[bot]