Skip to content

Commit 993aa61

Browse files
committed
Add verification notice UI for destination address
1 parent 1791e22 commit 993aa61

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

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

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,17 @@ struct WooShippingCreateLabelsView: View {
7575
}) {
7676
VStack {
7777
if !isShipmentDetailsExpanded {
78-
Text(Localization.BottomSheet.shipmentDetails)
79-
.foregroundStyle(Color(.primary))
80-
.bold()
78+
VStack {
79+
Text(Localization.BottomSheet.shipmentDetails)
80+
.foregroundStyle(Color(.primary))
81+
.bold()
82+
// TODO: Only display the notice if the address is unverified, or
83+
// if the address was just verified (and then auto-dismiss it after a couple seconds).
84+
addressVerificationNotice
85+
.onTapGesture {
86+
// TODO: Start address editing/verification flow if needed (if destination address is unverified).
87+
}
88+
}
8189
}
8290
if !viewModel.canViewLabel {
8391
if isiPhonePortrait {
@@ -278,6 +286,28 @@ private extension WooShippingCreateLabelsView {
278286
.font(.subheadline)
279287
.foregroundStyle(viewModel.isDestinationAddressVerified ? Layout.green : Layout.red)
280288
}
289+
290+
/// View showing a notice about the address verification status.
291+
var addressVerificationNotice: some View {
292+
HStack(spacing: 8) {
293+
Image(systemName: viewModel.isDestinationAddressVerified ? "checkmark.circle" : "exclamationmark.circle")
294+
Text(viewModel.isDestinationAddressVerified
295+
? Localization.AddressVerification.destinationVerified : Localization.AddressVerification.destinationUnverified)
296+
.frame(maxWidth: .infinity, alignment: .leading)
297+
Button {
298+
// TODO: Dismiss the notice.
299+
} label: {
300+
Image(systemName: "xmark")
301+
.renderedIf(!viewModel.isDestinationAddressVerified)
302+
}
303+
}
304+
.font(.subheadline)
305+
.foregroundStyle(viewModel.isDestinationAddressVerified ? Layout.green : Layout.red)
306+
.padding(.horizontal, 16)
307+
.padding(.vertical, 12)
308+
.background(RoundedRectangle(cornerRadius: Layout.cornerRadius)
309+
.fill(Color(uiColor: viewModel.isDestinationAddressVerified ? .withColorStudio(.green, shade: .shade0) : .withColorStudio(.red, shade: .shade0))))
310+
}
281311
}
282312

283313
// MARK: Store Options
@@ -379,6 +409,12 @@ private extension WooShippingCreateLabelsView {
379409
static let unverified = NSLocalizedString("wooShipping.createLabels.addressVerification.unverified",
380410
value: "Unverified address",
381411
comment: "Label when an address is unverified on the shipping label creation screen")
412+
static let destinationVerified = NSLocalizedString("wooShipping.createLabels.addressVerification.destinationVerified",
413+
value: "Verified destination address",
414+
comment: "Notice when a destination address is verified on the shipping label creation screen")
415+
static let destinationUnverified = NSLocalizedString("wooShipping.createLabels.addressVerification.destinationUnverified",
416+
value: "Destination address unverified",
417+
comment: "Notice when a destination address is unverified on the shipping label creation screen")
382418
}
383419
}
384420
}

0 commit comments

Comments
 (0)