Skip to content

Commit

Permalink
Make destinationAddressStatus optional and wait for the remote resp…
Browse files Browse the repository at this point in the history
…onse.
  • Loading branch information
selanthiraiyan committed Feb 25, 2025
1 parent aa2f4dd commit b169f7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,16 @@ private extension WooShippingCreateLabelsView {
}

/// View showing the address verification status for a destination address.
@ViewBuilder
var addressVerificationLabel: some View {
HStack(spacing: 4) {
Image(systemName: isDestinationAddressVerified ? "checkmark.circle" : "exclamationmark.circle")
Text(Localization.AddressVerification.label(for: viewModel.destinationAddressStatus))
if let destinationAddressStatus = viewModel.destinationAddressStatus {
HStack(spacing: 4) {
Image(systemName: isDestinationAddressVerified ? "checkmark.circle" : "exclamationmark.circle")
Text(Localization.AddressVerification.label(for: destinationAddressStatus))
}
.font(.subheadline)
.foregroundStyle(isDestinationAddressVerified ? Layout.green : Layout.red)
}
.font(.subheadline)
.foregroundStyle(isDestinationAddressVerified ? Layout.green : Layout.red)
}

/// View showing a notice about the destination address verification status.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ final class WooShippingCreateLabelsViewModel: ObservableObject {
case missing
}

// TODO: Add support for updating the destination address status when it is edited or verified remotely.
// TODO: Add support for updating the destination address status when it is edited.
/// The current destination address status.
@Published private(set) var destinationAddressStatus: DestinationAddressStatus = .unverified
@Published private(set) var destinationAddressStatus: DestinationAddressStatus?

/// This property can be set to display a notice with the provided label about the destination address status.
@Published var destinationAddressStatusNoticeLabel: String?
Expand Down Expand Up @@ -383,6 +383,7 @@ private extension WooShippingCreateLabelsViewModel {
func observeDestinationAddressStatus() {
/// Set the notice when the destination address status changes.
$destinationAddressStatus
.compactMap { $0 }
.map { status in
switch status {
case .verified:
Expand Down

0 comments on commit b169f7a

Please sign in to comment.