Skip to content

Conversation

@RafaelKayumov
Copy link
Contributor

@RafaelKayumov RafaelKayumov commented Oct 6, 2025

Part of: WOOMOB-1426

Description

Loads and displays customer data in Booking Details screen.

  • Adds loadCustomer as CustomerAction that fetches local Storage.Customer with given site ID and customer ID.
  • Replaces customerDetailsView method with distinct CustomerDetailsView for better data binding and code organizing.
  • Adds BookingDetailsViewModel.CustomerContent as a model for CustomerDetailsView as an ObservableObject with @Published properties.
  • In BookingDetailsViewModel implements customer data local fetching and API syncing.
  • Implements customer email copying to pasteboard on row tap.

Testing steps

  • Use a testing CIAB site with bookings
  • Navigate to Bookings tab
  • Locate a booking that contains a customer with non-empty readable content like name, email, phone and address.
  • Select the booking and navigate to details view.
  • Make sure the "Customer" section appears upon loading.
  • Make sure the "Customer" section contains correct data.
  • Locate a booking that doesn't have a customer / Or simulate this condition by setting customerID to 0 in bookings response by using Proxyman.
  • Select the booking and navigate to details view.
  • Make sure the "Customer" section disappeared.
  • Select the 1st booking with the valid customer details again and make sure the "Customer" section re-appeared.
  • Also in Booking Details with valid Customer section data - tap on email row that presents the "copy" icon. Make sure the email is copied to clipboard and the confirmation toast is presented.

Testing information

Tested on iOS 26 iPhone 17 and iPad simulators.

Screenshots

Снимок экрана 2025-10-08 в 17 36 06
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@RafaelKayumov RafaelKayumov added this to the 23.5 milestone Oct 6, 2025
@RafaelKayumov RafaelKayumov added the type: task An internally driven task. label Oct 6, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Oct 6, 2025

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 6, 2025

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

App NameWooCommerce iOS Prototype
Build Numberpr16214-7c2634e
Version23.4
Bundle IDcom.automattic.alpha.woocommerce
Commit7c2634e
Installation URL7kgqiu1l7t9ng
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@RafaelKayumov RafaelKayumov marked this pull request as ready for review October 7, 2025 21:49
Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

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

Tested with iPhone 17 simulator and confirmed that this works as expected. I left some nit-picking comments below.

Irrelevant to the PR: Please force the date and time displayed in the detail screen to use UTC like on the booking list as suggested in the thread p1759398245019489-slack-C09FHQNQERG. Currently, we're displaying different time on the two screens.

Comment on lines 2 to 4
import struct Networking.Booking
import struct Networking.Customer
import struct Networking.Address
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: It's not necessary to import these models from Networking as they are exported from Yosemite in Model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in be1c572

Comment on lines +136 to +138
withAnimation {
sections.insert(customerSection, at: 2)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

While running the app with Xcode, I saw a warning for this update: "Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates." Please consider marking updateCustomerSection with @MainActor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in the other PR in 2fee1b9726fe4b46d0732e83134d29de90e860eb

.foregroundStyle(Color.accentColor)
}
.padding(.vertical, Layout.rowTextVerticalPadding)
.tappable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the tap works only on image and text and not in the spacing in the middle. Please consider adding contentShape for the content in TappableViewModifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 396a379

}
.padding(.vertical, Layout.rowTextVerticalPadding)
.tappable {
print("On phone ellipsis")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be handled in this PR or a subsequent one? It may be necessary to hide the call button if a device does not support calling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll implement that in a separate PR

Comment on lines 80 to 81
let notice = Notice(title: Localization.emailCopiedMessage, feedbackType: .success)
ServiceLocator.noticePresenter.enqueue(notice: notice)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We can also use the .notice modifier instead of using the singleton.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reworked in 7c2634e

@RafaelKayumov RafaelKayumov force-pushed the WOOMOB-1426-load-and-apply-cusromer-data branch from a9ec0aa to 7c2634e Compare October 9, 2025 12:37
@RafaelKayumov RafaelKayumov merged commit 4e1797b into trunk Oct 9, 2025
16 checks passed
@RafaelKayumov RafaelKayumov deleted the WOOMOB-1426-load-and-apply-cusromer-data branch October 9, 2025 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants