@@ -101,17 +101,6 @@ struct PaymentMethodsView: View {
101101 ) {
102102 AttributedText ( viewModel. learnMoreViewModel. learnMoreAttributedString)
103103 } . padding ( . horizontal)
104-
105- NavigationLink ( isActive: $showingCashAlert) {
106- CashPaymentTenderView ( viewModel: CashPaymentTenderViewModel ( total: viewModel. total, formattedTotal: viewModel. formattedTotal) { info in
107- Task { @MainActor in
108- await viewModel. markOrderAsPaidByCash ( with: info)
109- dismiss ( )
110- }
111- } )
112- } label: {
113- EmptyView ( )
114- } . hidden ( )
115104 }
116105
117106 // Pushes content to the top
@@ -145,6 +134,15 @@ struct PaymentMethodsView: View {
145134 }
146135 . background ( FullScreenCoverClearBackgroundView ( ) )
147136 }
137+ . navigationDestination ( isPresented: $showingCashAlert) {
138+ CashPaymentTenderView ( viewModel: CashPaymentTenderViewModel ( total: viewModel. total,
139+ formattedTotal: viewModel. formattedTotal) { info in
140+ Task { @MainActor in
141+ await viewModel. markOrderAsPaidByCash ( with: info)
142+ dismiss ( )
143+ }
144+ } )
145+ }
148146 . onAppear {
149147 guard rootViewController != nil else {
150148 return viewModel. logNoRootViewControllerError ( )
@@ -252,28 +250,16 @@ extension PaymentMethodsView {
252250 }
253251}
254252
255- // MARK: Previews
256- struct PaymentMethodsView_Preview : PreviewProvider {
257- static var previews : some View {
258- NavigationView {
259- PaymentMethodsView ( viewModel: . init( total: " 15.99 " , formattedTotal: " $15.99 " , flow: . orderPayment, channel: . storeManagement) )
260- . navigationBarTitleDisplayMode ( . inline)
261- }
262- . environment ( \. colorScheme, . light)
263- . previewDisplayName ( " Light " )
264-
265- NavigationView {
266- PaymentMethodsView ( viewModel: . init( total: " 15.99 " , formattedTotal: " $15.99 " , flow: . orderPayment, channel: . storeManagement) )
267- . navigationBarTitleDisplayMode ( . inline)
268- }
269- . environment ( \. colorScheme, . dark)
270- . previewDisplayName ( " Dark " )
271-
272- NavigationView {
273- PaymentMethodsView ( viewModel: . init( total: " 15.99 " , formattedTotal: " $15.99 " , flow: . orderPayment, channel: . storeManagement) )
274- . navigationBarTitleDisplayMode ( . inline)
275- }
276- . environment ( \. sizeCategory, . accessibilityExtraExtraLarge)
277- . previewDisplayName ( " Accessibility " )
253+ #Preview {
254+ @Previewable @State var rootViewController = UIViewController ( )
255+ NavigationStack {
256+ PaymentMethodsView (
257+ rootViewController: rootViewController,
258+ viewModel: PaymentMethodsViewModel ( total: " 15.99 " ,
259+ formattedTotal: " $15.99 " ,
260+ flow: . orderPayment,
261+ channel: . storeManagement)
262+ )
263+ . navigationBarTitleDisplayMode ( . inline)
278264 }
279265}
0 commit comments