Skip to content

Commit 6aa63cb

Browse files
committed
Add a support CTA to store creation summary view.
1 parent bf0c6f8 commit 6aa63cb

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

WooCommerce/Classes/Authentication/Store Creation/StoreCreationCoordinator.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ private extension StoreCreationCoordinator {
436436
planToPurchase: planToPurchase,
437437
siteID: result.siteID,
438438
siteSlug: result.siteSlug)
439+
} onSupport: { [weak self] in
440+
self?.showSupport(from: navigationController)
439441
}
440442
navigationController.pushViewController(storeSummary, animated: true)
441443
analytics.track(event: .StoreCreation.siteCreationStep(step: .storeSummary))

WooCommerce/Classes/Authentication/Store Creation/StoreCreationSummaryView.swift

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ import SwiftUI
22

33
/// Hosting controller that wraps the `StoreCreationSummaryView`.
44
final class StoreCreationSummaryHostingController: UIHostingController<StoreCreationSummaryView> {
5-
private let onContinueToPayment: () -> Void
6-
75
init(viewModel: StoreCreationSummaryViewModel,
8-
onContinueToPayment: @escaping () -> Void) {
9-
self.onContinueToPayment = onContinueToPayment
10-
super.init(rootView: StoreCreationSummaryView(viewModel: viewModel))
11-
12-
rootView.onContinueToPayment = { [weak self] in
13-
self?.onContinueToPayment()
14-
}
6+
onContinueToPayment: @escaping () -> Void,
7+
onSupport: @escaping () -> Void) {
8+
super.init(rootView: StoreCreationSummaryView(viewModel: viewModel,
9+
onContinueToPayment: onContinueToPayment,
10+
onSupport: onSupport))
1511
}
1612

1713
@available(*, unavailable)
@@ -52,13 +48,17 @@ struct StoreCreationSummaryViewModel {
5248

5349
/// Displays a summary of the store creation flow with the store information (e.g. store name, store slug).
5450
struct StoreCreationSummaryView: View {
55-
/// Set in the hosting controller.
56-
var onContinueToPayment: (() -> Void) = {}
51+
private let onContinueToPayment: () -> Void
52+
private let onSupport: () -> Void
5753

5854
private let viewModel: StoreCreationSummaryViewModel
5955

60-
init(viewModel: StoreCreationSummaryViewModel) {
56+
init(viewModel: StoreCreationSummaryViewModel,
57+
onContinueToPayment: @escaping () -> Void,
58+
onSupport: @escaping () -> Void) {
6159
self.viewModel = viewModel
60+
self.onContinueToPayment = onContinueToPayment
61+
self.onSupport = onSupport
6262
}
6363

6464
var body: some View {
@@ -126,6 +126,18 @@ struct StoreCreationSummaryView: View {
126126
.padding(Layout.defaultButtonPadding)
127127
}
128128
}
129+
.toolbar {
130+
ToolbarItem(placement: .navigationBarTrailing) {
131+
Button {
132+
onSupport()
133+
} label: {
134+
Image(uiImage: .helpOutlineImage)
135+
.renderingMode(.template)
136+
.linkStyle()
137+
}
138+
.accessibilityLabel(Localization.supportButtonAccessibilityLabel)
139+
}
140+
}
129141
.navigationTitle(Localization.title)
130142
.navigationBarTitleDisplayMode(.large)
131143
}
@@ -152,6 +164,10 @@ private extension StoreCreationSummaryView {
152164
"Continue to Payment",
153165
comment: "Title of the button on the store creation summary view to continue to payment."
154166
)
167+
static let supportButtonAccessibilityLabel = NSLocalizedString(
168+
"Help & Support",
169+
comment: "Accessibility label for the Help & Support image navigation bar button in the store creation flow."
170+
)
155171
}
156172
}
157173

@@ -168,12 +184,16 @@ struct StoreCreationSummaryView_Previews: PreviewProvider {
168184
.init(storeName: "Fruity shop",
169185
storeSlug: "fruityshop.com",
170186
categoryName: "Arts and Crafts",
171-
countryCode: .UG))
187+
countryCode: .UG),
188+
onContinueToPayment: {},
189+
onSupport: {})
172190
StoreCreationSummaryView(viewModel:
173191
.init(storeName: "Fruity shop",
174192
storeSlug: "fruityshop.com",
175193
categoryName: "Arts and Crafts",
176-
countryCode: nil))
194+
countryCode: nil),
195+
onContinueToPayment: {},
196+
onSupport: {})
177197
.preferredColorScheme(.dark)
178198
}
179199
}

0 commit comments

Comments
 (0)