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] Edit selected package #14713

Merged
merged 7 commits into from
Dec 19, 2024

Conversation

rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Dec 17, 2024

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

Description

This PR handles editing the selected package in the Woo Shipping label flow. After selecting a package, you can tap the pencil icon to select a different package.

How

  • WooShippingSelectedPackageView now opens WooShippingAddPackageView with the previously selected package data when the pencil icon is tapped. It also has an updateSelectedPackage closure that is used to update the selected package in WooShippingCreateLabelsViewModel if a new package is selected.
  • WooShippingAddCustomPackageViewModel now accepts a preselected package:
    • It prefills the package type and dimensions with the package data.
    • It does not prefill the other fields (weight and name) since those are specific to saved templates and can be re-entered if a new template is being saved.
  • WooShippingAddPackageViewModel now accepts a selected package:
    • It tracks the previously selected package so the view will select it unless a new package has been selected.
    • When transforming package data, if the previously selected package is still selected, it will set the corresponding tab and carrier tab so the view opens to the correct place.

Testing information

  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 a package or enter custom package data and add the package.
  9. Tap the pencil icon and confirm the add package view opens again with the previous selection (either the custom package data on the custom tab, or the carrier/saved tab with the correct package selected).
  10. Pull to refresh the carrier/saved tab and confirm the previous selection is still selected.
  11. Select a different package.
  12. Pull to refresh the carrier/saved tab and confirm the new selection is still selected.

Screenshots

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-12-17.at.16.32.04.mp4

  • 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

wpmobilebot commented Dec 17, 2024

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 Numberpr14713-b16aa65
Version21.2
Bundle IDcom.automattic.alpha.woocommerce
Commitb16aa65
App Center BuildWooCommerce - Prototype Builds #12236
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Preselect correct tabs for previously selected package
@rachelmcr rachelmcr force-pushed the issue/14522-edit-selected-package branch from 3f15f64 to 817882a Compare December 17, 2024 16:46
@rachelmcr rachelmcr marked this pull request as ready for review December 17, 2024 17:41
Copy link
Contributor

@bozidarsevo bozidarsevo left a comment

Choose a reason for hiding this comment

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

Would it be possible to scroll to selected package when we edit selected package?

In this example I select a starred/saved carrier package and when I go to edit it, the saved list is showed but that selected package is not visible.

Maybe we can leave that for a separate PR?

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-12-19.at.16.53.28.mp4

@rachelmcr
Copy link
Contributor Author

Would it be possible to scroll to selected package when we edit selected package?

Good idea, tracked in #14734.

Base automatically changed from issue/14522-fetch-cached-packages to trunk December 19, 2024 19:00
@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 07fff78 into trunk Dec 19, 2024
13 checks passed
@rachelmcr rachelmcr deleted the issue/14522-edit-selected-package branch December 19, 2024 20:37
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