Skip to content

[Payment Method Improvements] AppBar and Navigation for ChangeDueCalculatorFragment #11532

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

Merged

Conversation

backwardstruck
Copy link
Contributor

@backwardstruck backwardstruck commented May 16, 2024

Addresses: #11525

Description

UI improvements for ChangeDueCalculatorFragment to provide a consistent title bar. This is the first PR for the GH issue, which contains other tasks.

Testing instructions

  1. Enable OTHER_PAYMENT_METHODS FF
  2. Navigate to the cash payment screen
  3. Check AppBar Title:
    • Ensure the title is centered and displays dynamic content in various states (e.g., during loading and on displaying success state).
  4. Back Button Functionality:
    • Click the back button and verify it navigates to the prior screen correctly across different app states.
  5. Rotation Consistency:
    • Ensure that the AppBar works in phone and tablet mode
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@backwardstruck backwardstruck added feature: mobile payments Related to mobile payments / card present payments / Woo Payments. status: feature-flagged Behind a feature flag. Milestone is not strongly held. labels May 16, 2024
@backwardstruck backwardstruck modified the milestones: 18.8, 18.7 May 16, 2024
@backwardstruck backwardstruck marked this pull request as ready for review May 16, 2024 19:25
@backwardstruck backwardstruck requested a review from kidinov May 16, 2024 19:27
@backwardstruck
Copy link
Contributor Author

@kidinov this is targeted at 18.7 but can go into 18.8 if I don't merge in time.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 16, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
FlavorJalapeno
Build TypeDebug
Commit46e0e7c
Direct Downloadwoocommerce-prototype-build-pr11532-46e0e7c.apk

@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 40.47%. Comparing base (663f191) to head (46e0e7c).
Report is 16 commits behind head on trunk.

Files Patch % Lines
...ts/methodselection/ChangeDueCalculatorViewModel.kt 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #11532      +/-   ##
============================================
+ Coverage     40.44%   40.47%   +0.02%     
- Complexity     5197     5201       +4     
============================================
  Files          1083     1083              
  Lines         63001    63006       +5     
  Branches       8635     8635              
============================================
+ Hits          25481    25500      +19     
+ Misses        35226    35210      -16     
- Partials       2294     2296       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kidinov kidinov modified the milestones: 18.7, 18.8 May 17, 2024
@kidinov kidinov self-assigned this May 17, 2024
@kidinov kidinov self-requested a review May 17, 2024 10:44
Copy link
Contributor

@kidinov kidinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overal lgtm! I left a few suggestions, please take a look

@soundsokay
Copy link

If closing the test coverage gap noted by the Codecov Report for ChangeDueCalculatorFragment isn't planned to be addressed in this PR and isn't already covered by a ticket or task please file one as a reminder to get back to this later.

@backwardstruck
Copy link
Contributor Author

If closing the test coverage gap noted by the Codecov Report for ChangeDueCalculatorFragment isn't planned to be addressed in this PR and isn't already covered by a ticket or task please file one as a reminder to get back to this later.

Yes, I will address those in this ticket as there's more functionality to be added that will also require tests.

@backwardstruck
Copy link
Contributor Author

Overal lgtm! I left a few suggestions, please take a look

Thanks @kidinov This should be ready for review again now that I've pushed those changes.

@kidinov kidinov self-requested a review May 20, 2024 15:58
Copy link
Contributor

@kidinov kidinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I noticed 2 small things though:

  • Too make passing orderId mandatory and have compile time validation you can declare argument as part of the arguments for the fragment:
    <fragment
        android:id="@+id/changeDueCalculatorFragment"
        android:name="com.woocommerce.android.ui.payments.methodselection.ChangeDueCalculatorFragment"
        android:label="ChangeDueCalculatorFragment" >
        <argument
            android:name="orderId"
            app:argType="long" />
    </fragment>

And then in the VM you can get the object with

private val navArgs: ChangeDueCalculatorFragmentArgs by savedStateHandle.navArgs()
navArgs.orderId

And also I noticed that you placed these calses into methodselection package which probably not the most appropriate place for that. I'd go with payments/changeduecalculator

Feel free to address that in the following PRs

@backwardstruck
Copy link
Contributor Author

Thanks @kidinov those are very good suggestions. Indeed, I forgot to move the classes to changeduecalculator. I will address these in my next PR. They are listed in this new GH issue:

#11553

@backwardstruck backwardstruck merged commit 75b99e8 into trunk May 20, 2024
14 checks passed
@backwardstruck backwardstruck deleted the 11525-implement-change-due-calculator-ui-for-cash-payments branch May 20, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: mobile payments Related to mobile payments / card present payments / Woo Payments. status: feature-flagged Behind a feature flag. Milestone is not strongly held.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants