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] Make edit address form reusable for both origin and destination addresses #14866

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

rachelmcr
Copy link
Contributor

Part of: #13781
⚠️ Depends on #14865 ⚠️

Description

This makes the address form in the Woo Shipping label flow reusable for editing both origin and destination addresses.

Changes in this PR:

  • Adds an addressType property to track what type of address is being edited.
  • Only shows the "Save as default" toggle for origin addresses. (And renames the saveAsDefault property to isDefault for clarity.)
  • Adds a convenience initializer to the view model for editing origin addresses.

Testing information

There should be no visible changes to the current behavior:

  1. Ensure the Woo Shipping extension is installed, activated, and set up on your store.
  2. Create or open an order with at least one physical product and the processing status.
  3. Tap "Create Shipping Label" in order details.
  4. Open the "Shipment details" bottom sheet.
  5. Tap the "Ship from" origin address.
  6. Tap the edit (pencil) icon on one of the origin addresses.
  7. In the address form, confirm you still see the "save as default" toggle at the bottom of the form.
  8. Confirm all of the fields are pre-populated with the expected address details.

  • 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 Jan 14, 2025
@rachelmcr rachelmcr added this to the 21.5 milestone Jan 14, 2025
@rachelmcr rachelmcr requested a review from toupper January 14, 2025 17:18
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@rachelmcr rachelmcr force-pushed the issue/13781-reuse-address-form branch from e8ab012 to 37a3db3 Compare January 14, 2025 17:55
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 14, 2025

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 Numberpr14866-babdfa1
Version21.4
Bundle IDcom.automattic.alpha.woocommerce
Commitbabdfa1
App Center BuildWooCommerce - Prototype Builds #12542
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@rachelmcr
Copy link
Contributor Author

Checking on the build failure with the infra team: p1736878667017449-slack-CC7L49W13

Base automatically changed from issue/13781-basic-local-requirements to trunk January 15, 2025 09:42
@@ -12,19 +23,27 @@ final class WooShippingEditAddressViewModel: ObservableObject, Identifiable {
@Published var postalCode: String
@Published var email: String
@Published var phone: String
@Published var saveAsDefault: Bool
@Published var isDefault: Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor thing, can we make this property more meaningful? What is default here, the address? in that case, can we name it as isDefaultAddress?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, good point; updated both the property and the init parameter in babdfa1.

Copy link
Contributor

@toupper toupper left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀 🚢

@rachelmcr rachelmcr enabled auto-merge January 15, 2025 09:56
@rachelmcr rachelmcr merged commit 0060aad into trunk Jan 15, 2025
11 of 12 checks passed
@rachelmcr rachelmcr deleted the issue/13781-reuse-address-form branch January 15, 2025 10:16
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