-
Notifications
You must be signed in to change notification settings - Fork 137
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
[Shipping Labels Revamp] Fix custom package dimension units #13214
Conversation
…nedPackagesFromStore use case
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #13214 +/- ##
============================================
+ Coverage 40.61% 40.62% +0.01%
- Complexity 6386 6388 +2
============================================
Files 1351 1351
Lines 77525 77562 +37
Branches 10659 10665 +6
============================================
+ Hits 31486 31512 +26
- Misses 43259 43270 +11
Partials 2780 2780 ☔ View full report in Codecov by Sentry. |
@@ -50,6 +52,14 @@ class FetchPredefinedPackagesFromStore @Inject constructor( | |||
.let { Carrier.DHL to it } | |||
) | |||
|
|||
private fun StoreOptionsDAO.toStoreOptionsForPackages() = | |||
StoreOptionsForPackages( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThomazFB, do you think we need other store options class for packages?
We already refresh store options when we start the purchase flow with the ObserveStoreOptions
, and we cache that data. I might be missing something, but re-using the use case could help us maintain a single source of truth. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @atorresveiga! I considered using it, but the thing is: these store options we're talking about are coming from the Package request we have to do to display the selection data; it comes for free. while re-using the use case would add complexity or maybe an additional request to a data that's already there for us to use. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Why
Every Package request comes with the Store Options data. This data is essential for the entire package selection structure, but the data wasn't being held by the main ViewModel, which blocked some scenarios where Store Options were required after the request.
How
Updates the Package selection flow to keep the StoreOptions data returned by the Packages endpoint, and map the dimensions unit in it to the Custom package creation, allowing the Custom package to keep the correct unit type.
How to Test
Update release notes:
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: