Skip to content
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] Upsert create packages response after saving packages remotely #14710

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Dec 17, 2024

Part of: #14522
⚠️ Depends on #14690 ⚠️

Description

This PR caches the saved packages received from remote after saving (starring) a package, so we can fetch those saved packages from storage during Woo Shipping label creation:

  • Updates WooShippingStore.createPackage(siteID:customPackage:predefinedOption:completion:) to upsert the response received from remote:
    • Adds methods to upsert WooShippingCreatePackageResponse in the background by handling the custom packages and saved predefined package IDs in that response.
    • Updates the methods that upsert custom packages and saved predefined packages, so they take those package arrays as parameters instead of a complete packages response. This way we can reuse those storage methods when we receive a WooShippingCreatePackageResponse.
    • Adds a method to transform the saved predefined package IDs into saved packages for storage. (This uses the logic from WooShippingAddPackageViewModel, where we were previously doing this transformation.)

Testing information

Confirm unit tests pass. You can also confirm the packages response continues to work as expected:

  1. Install and set up the Woo Shipping extension on your store.
  2. Build and run the app with the revampedShippingLabelCreation feature flag enabled.
  3. Create an order with the processing status and at least one physical product.
  4. In your WooCommerce product settings on the web, change the weight and dimension units and save your changes.
  5. On the Orders tab in the app, open the order you created.
  6. In the order details, select "Create Shipping Label."
  7. Immediately tap "Select a Package."
  8. Select the Saved tab and confirm the expected packages appear.

  • I have considered if this change warrants user-facing release notes and have added them to 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:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@rachelmcr rachelmcr added the feature: shipping labels Related to creating, ordering, or printing shipping labels. label Dec 17, 2024
@rachelmcr rachelmcr added this to the 21.3 milestone Dec 17, 2024
@wpmobilebot
Copy link
Collaborator

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

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14710-0a8fb41
Version21.2
Bundle IDcom.automattic.alpha.woocommerce
Commit0a8fb41
App Center BuildWooCommerce - Prototype Builds #12170
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Base automatically changed from issue/14522-cache-packages-response-yosemite to trunk December 18, 2024 12:34
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 21.3. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@rachelmcr rachelmcr merged commit 0daaa02 into trunk Dec 18, 2024
19 of 22 checks passed
@rachelmcr rachelmcr deleted the issue/14522-cache-create-package-response-yosemite branch December 18, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: shipping labels Related to creating, ordering, or printing shipping labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants