Skip to content

Commit 1791e22

Browse files
committed
Add verification status label for destination address
1 parent a553f74 commit 1791e22

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingCreateLabelsView.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ struct WooShippingCreateLabelsView: View {
143143
line.bold()
144144
}
145145
}
146+
addressVerificationLabel
146147
}
147148
.frame(maxWidth: .infinity, alignment: .leading)
148149
}
@@ -266,6 +267,17 @@ private extension WooShippingCreateLabelsView {
266267
.buttonStyle(PrimaryLoadingButtonStyle(isLoading: viewModel.isPurchasingLabel))
267268
.disabled(!viewModel.isPurchaseButtonEnabled)
268269
}
270+
271+
/// View showing the address verification status.
272+
var addressVerificationLabel: some View {
273+
HStack(spacing: 4) {
274+
Image(systemName: viewModel.isDestinationAddressVerified ? "checkmark.circle" : "exclamationmark.circle")
275+
Text(viewModel.isDestinationAddressVerified
276+
? Localization.AddressVerification.verified : Localization.AddressVerification.unverified)
277+
}
278+
.font(.subheadline)
279+
.foregroundStyle(viewModel.isDestinationAddressVerified ? Layout.green : Layout.red)
280+
}
269281
}
270282

271283
// MARK: Store Options
@@ -294,6 +306,10 @@ private extension WooShippingCreateLabelsView {
294306
static let ellipsisWidth: CGFloat = 22
295307
static let bottomSheetSpacing: CGFloat = 16
296308
static let bottomSheetPadding: CGFloat = 16
309+
static let green = Color(UIColor(light: .withColorStudio(.green, shade: .shade60),
310+
dark: .withColorStudio(.green, shade: .shade40)))
311+
static let red = Color(UIColor(light: .withColorStudio(.red, shade: .shade60),
312+
dark: .withColorStudio(.red, shade: .shade40)))
297313
}
298314

299315
enum Localization {
@@ -355,5 +371,14 @@ private extension WooShippingCreateLabelsView {
355371
comment: "Label for button to purchase the shipping label on the shipping label creation screen, " +
356372
"including the label price. Reads like: 'Purchase Label · $7.63'")
357373
}
374+
375+
enum AddressVerification {
376+
static let verified = NSLocalizedString("wooShipping.createLabels.addressVerification.verified",
377+
value: "Address verified",
378+
comment: "Label when an address is verified on the shipping label creation screen")
379+
static let unverified = NSLocalizedString("wooShipping.createLabels.addressVerification.unverified",
380+
value: "Unverified address",
381+
comment: "Label when an address is unverified on the shipping label creation screen")
382+
}
358383
}
359384
}

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingCreateLabelsViewModel.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ final class WooShippingCreateLabelsViewModel: ObservableObject {
6565
(destinationAddress?.formattedPostalAddress ?? "").components(separatedBy: .newlines)
6666
}()
6767

68+
// TODO: Add support for checking if the destination address is verified.
69+
/// Whether the destination address is verified.
70+
@Published private(set) var isDestinationAddressVerified: Bool = false
71+
6872
/// Shipping lines for the order, with formatted amount.
6973
let shippingLines: [WooShipping_ShippingLineViewModel]
7074

0 commit comments

Comments
 (0)