-
Notifications
You must be signed in to change notification settings - Fork 114
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] Set selected package from "Add Package" flow #14558
Conversation
83a0c38
to
225937c
Compare
@bozidarsevo I wanted to get your review on this PR because it's linking the package data from the I'm also happy to wait to merge this PR until #14499 is merged, to deal with any conflicts. |
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
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.
I think we can merge this PR before mine, it will be easier to update conflicts in mine (if there will be some) 👍
@@ -25,7 +29,7 @@ struct WooShippingPackageAndRatePlaceholder: View { | |||
.roundedBorder(cornerRadius: Layout.borderCornerRadius, lineColor: Color(.border), lineWidth: Layout.borderLineWidth, dashed: true) | |||
.sheet(isPresented: $showAddPackage) { | |||
WooShippingAddPackageView { packageData in | |||
// TODO: use packageData | |||
onSelectPackage(packageData) |
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.
Happy that we can finally remove this TODO 🥳
Part of: #14522
Description
We want to display the selected package from the "Select a Package" section on the main shipping label screen in the Woo Shipping label creation flow.
This PR connects the "Select a Package" flow with the main screen's view model, so the selected package can be used on the main screen.
For now, this loads the label rates in the Shipping Services section. A future PR will also add the UI to display the selected package details and allow the shipment weight to be updated.
How
WooShippingPackageAndRatePlaceholder
, theWooShippingAddPackageView
passes back the package data for the selected package. Now, that placeholder view has anonSelectPackage
closure to handle that data.WooShippingCreateLabelsViewModel
, we now have aselectPackage(_:)
method that accepts package data.WooShippingPackageAndRatePlaceholder
view.ShippingLabelPackageSelected
, which is used to make calls to the backend that require the selected package. This method also loads the shipping rates for the selected package.WooShippingAddCustomPackageViewModel
we now set the ID for a custom package as the package name. The backend expects the custom package ID to be its name.0
when encoding it for remote requests. This is to match the endpoint behavior discussed with the extension team (see p1731538721371119-slack-C05VBLKHHV1).Testing information
Prerequisite: The Woo Shipping extension is active on your store and you have at least one order eligible for a shipping label (with
processing
status and at least one physical product).revampedShippingLabelCreation
feature flag.Screenshots
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-11-28.at.18.02.18.mp4
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: