@@ -2,16 +2,12 @@ import SwiftUI
22
33/// Hosting controller that wraps the `StoreCreationSummaryView`.
44final 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).
5450struct 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