From 8d723fa9b9002f3d500150efc66990a917d2925c Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Mon, 23 Dec 2024 18:35:11 +0700 Subject: [PATCH] Update cash view to dismiss via environment --- .../POS/Presentation/PointOfSaleCollectCashView.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/WooCommerce/Classes/POS/Presentation/PointOfSaleCollectCashView.swift b/WooCommerce/Classes/POS/Presentation/PointOfSaleCollectCashView.swift index c3dd659d556..87a0f4b4943 100644 --- a/WooCommerce/Classes/POS/Presentation/PointOfSaleCollectCashView.swift +++ b/WooCommerce/Classes/POS/Presentation/PointOfSaleCollectCashView.swift @@ -1,13 +1,13 @@ import SwiftUI struct PointOfSaleCollectCashView: View { + @Environment(\.dismiss) private var dismiss @EnvironmentObject private var posModel: PointOfSaleAggregateModel @State private var textFieldAmountInput: String = "" @State private var isLoading: Bool = false @State private var errorMessage: String? - @Binding var isVisible: Bool let orderTotal: String private var formattedOrderTotal: String { @@ -18,7 +18,7 @@ struct PointOfSaleCollectCashView: View { VStack(alignment: .center, spacing: 20) { HStack { Button(action: { - isVisible = false + dismiss() }, label: { VStack { HStack { @@ -131,7 +131,6 @@ private extension PointOfSaleCollectCashView { itemsController: PointOfSalePreviewItemsController(), cardPresentPaymentService: CardPresentPaymentPreviewService(), orderController: PointOfSalePreviewOrderController()) - PointOfSaleCollectCashView(isVisible: .constant(true), - orderTotal: "$1.23") + PointOfSaleCollectCashView(orderTotal: "$1.23") .environmentObject(posModel) }