From c5ef164e6435a302705be976746f5688f75f1ebf Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 29 Oct 2025 15:46:47 +0700 Subject: [PATCH 1/6] move to private extension --- ...ointOfSaleSettingsHardwareDetailView.swift | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift index 21ce9657cc6..8dff0f24574 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift @@ -89,17 +89,11 @@ struct PointOfSaleSettingsHardwareDetailView: View { } } } +} - private func handleScannerDestination(_ destination: ScannerDestination) { - switch destination { - case .setup: - showBarcodeScanningSetupModal = true - case .documentation: - showBarcodeScanningDocumentationModal = true - } - } - - private var legacyCardReadersView: some View { +// MARK: - Views +private extension PointOfSaleSettingsHardwareDetailView { + var legacyCardReadersView: some View { VStack(spacing: POSSpacing.none) { POSPageHeaderView( title: Localization.cardReadersTitle, @@ -168,7 +162,7 @@ struct PointOfSaleSettingsHardwareDetailView: View { } } - private var cardReadersView: some View { + var cardReadersView: some View { VStack(spacing: POSSpacing.none) { POSPageHeaderView( title: Localization.cardReadersTitle, @@ -224,7 +218,7 @@ struct PointOfSaleSettingsHardwareDetailView: View { } } - private var scannersView: some View { + var scannersView: some View { VStack(spacing: POSSpacing.none) { POSPageHeaderView( title: Localization.scannersTitle, @@ -340,8 +334,18 @@ private extension PointOfSaleSettingsHardwareDetailView { } } } + + private func handleScannerDestination(_ destination: ScannerDestination) { + switch destination { + case .setup: + showBarcodeScanningSetupModal = true + case .documentation: + showBarcodeScanningDocumentationModal = true + } + } } +// MARK: - Constants private extension PointOfSaleSettingsHardwareDetailView { enum Localization { static let readerModelTitle = NSLocalizedString( From 79e3a0d689492880a13da10c6789a45133e16c04 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 29 Oct 2025 15:54:10 +0700 Subject: [PATCH 2/6] update prefix of involved files --- .../Models/PointOfSaleAggregateModel.swift | 4 ++-- .../Models/PointOfSaleSettingsController.swift | 6 +++--- ...nerSetup.swift => POSBarcodeScannerSetup.swift} | 6 +++--- .../PointOfSale/Presentation/CartView.swift | 2 +- .../Presentation/POSFloatingControlView.swift | 2 +- .../Presentation/PointOfSaleEntryPointView.swift | 2 +- .../Reusable Views/POSModalViewModifier.swift | 2 +- ...w.swift => POSSettingsHardwareDetailView.swift} | 14 +++++++------- .../PointOfSaleSettingsStoreDetailView.swift | 2 +- .../Settings/PointOfSaleSettingsView.swift | 6 +++--- .../Sources/PointOfSale/Utils/PreviewHelpers.swift | 2 +- ...ests.swift => POSSettingsControllerTests.swift} | 4 ++-- .../Models/PointOfSaleAggregateModelTests.swift | 2 +- .../Presentation/POSItemActionHandlerTests.swift | 2 +- 14 files changed, 28 insertions(+), 28 deletions(-) rename Modules/Sources/PointOfSale/Presentation/Barcode Scanner Setup/{PointOfSaleBarcodeScannerSetup.swift => POSBarcodeScannerSetup.swift} (97%) rename Modules/Sources/PointOfSale/Presentation/Settings/{PointOfSaleSettingsHardwareDetailView.swift => POSSettingsHardwareDetailView.swift} (97%) rename Modules/Tests/PointOfSaleTests/Controllers/{PointOfSaleSettingsControllerTests.swift => POSSettingsControllerTests.swift} (96%) diff --git a/Modules/Sources/PointOfSale/Models/PointOfSaleAggregateModel.swift b/Modules/Sources/PointOfSale/Models/PointOfSaleAggregateModel.swift index 85f96bd19fc..05f9b19f753 100644 --- a/Modules/Sources/PointOfSale/Models/PointOfSaleAggregateModel.swift +++ b/Modules/Sources/PointOfSale/Models/PointOfSaleAggregateModel.swift @@ -43,7 +43,7 @@ protocol PointOfSaleAggregateModelProtocol { let popularPurchasableItemsController: PointOfSaleItemsControllerProtocol let couponsController: PointOfSaleCouponsControllerProtocol let couponsSearchController: PointOfSaleSearchingItemsControllerProtocol - let settingsController: PointOfSaleSettingsControllerProtocol + let settingsController: POSSettingsControllerProtocol private let cardPresentPaymentService: CardPresentPaymentFacade private let orderController: PointOfSaleOrderControllerProtocol @@ -79,7 +79,7 @@ protocol PointOfSaleAggregateModelProtocol { couponsSearchController: PointOfSaleSearchingItemsControllerProtocol, cardPresentPaymentService: CardPresentPaymentFacade, orderController: PointOfSaleOrderControllerProtocol, - settingsController: PointOfSaleSettingsControllerProtocol, + settingsController: POSSettingsControllerProtocol, analytics: POSAnalyticsProviding, collectOrderPaymentAnalyticsTracker: POSCollectOrderPaymentAnalyticsTracking, searchHistoryService: POSSearchHistoryProviding, diff --git a/Modules/Sources/PointOfSale/Models/PointOfSaleSettingsController.swift b/Modules/Sources/PointOfSale/Models/PointOfSaleSettingsController.swift index 05e6bc2ed2b..808bbfb1ed6 100644 --- a/Modules/Sources/PointOfSale/Models/PointOfSaleSettingsController.swift +++ b/Modules/Sources/PointOfSale/Models/PointOfSaleSettingsController.swift @@ -11,14 +11,14 @@ import protocol Storage.GRDBManagerProtocol import protocol Yosemite.POSCatalogSyncCoordinatorProtocol import class Yosemite.POSCatalogSettingsService -protocol PointOfSaleSettingsControllerProtocol { +protocol POSSettingsControllerProtocol { var connectedCardReader: CardPresentPaymentCardReader? { get } var storeViewModel: POSSettingsStoreViewModel { get } var localCatalogViewModel: POSSettingsLocalCatalogViewModel? { get } var isLocalCatalogEligible: Bool { get } } -@Observable final class PointOfSaleSettingsController: PointOfSaleSettingsControllerProtocol { +@Observable final class PointOfSaleSettingsController: POSSettingsControllerProtocol { private(set) var connectedCardReader: CardPresentPaymentCardReader? private var cancellables: AnyCancellable? @@ -72,7 +72,7 @@ protocol PointOfSaleSettingsControllerProtocol { } #if DEBUG -final class PointOfSaleSettingsPreviewController: PointOfSaleSettingsControllerProtocol { +final class POSSettingsPreviewController: POSSettingsControllerProtocol { var connectedCardReader: CardPresentPaymentCardReader? = CardPresentPaymentCardReader( name: "WisePad 3", batteryLevel: 0.75 diff --git a/Modules/Sources/PointOfSale/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetup.swift b/Modules/Sources/PointOfSale/Presentation/Barcode Scanner Setup/POSBarcodeScannerSetup.swift similarity index 97% rename from Modules/Sources/PointOfSale/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetup.swift rename to Modules/Sources/PointOfSale/Presentation/Barcode Scanner Setup/POSBarcodeScannerSetup.swift index ea4f942998c..6b80b6db257 100644 --- a/Modules/Sources/PointOfSale/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetup.swift +++ b/Modules/Sources/PointOfSale/Presentation/Barcode Scanner Setup/POSBarcodeScannerSetup.swift @@ -1,6 +1,6 @@ import SwiftUI -struct PointOfSaleBarcodeScannerSetup: View { +struct POSBarcodeScannerSetup: View { @Binding var isPresented: Bool @State private var flowManager: PointOfSaleBarcodeScannerSetupFlowManager @Environment(\.posModalParentSize) var parentSize @@ -91,7 +91,7 @@ private enum Constants { } // MARK: - Private Localization Extension -private extension PointOfSaleBarcodeScannerSetup { +private extension POSBarcodeScannerSetup { enum Localization { static let starBSH20BTitle = NSLocalizedString( "pos.barcodeScannerSetup.starBSH20B.title", @@ -120,7 +120,7 @@ private extension PointOfSaleBarcodeScannerSetup { #if DEBUG #Preview { - PointOfSaleBarcodeScannerSetup(isPresented: .constant(true), analytics: EmptyPOSAnalytics()) + POSBarcodeScannerSetup(isPresented: .constant(true), analytics: EmptyPOSAnalytics()) } #endif diff --git a/Modules/Sources/PointOfSale/Presentation/CartView.swift b/Modules/Sources/PointOfSale/Presentation/CartView.swift index 60fe0e30e7c..1c594cad998 100644 --- a/Modules/Sources/PointOfSale/Presentation/CartView.swift +++ b/Modules/Sources/PointOfSale/Presentation/CartView.swift @@ -69,7 +69,7 @@ struct CartView: View { } } .posModal(isPresented: $showBarcodeScanningModal) { - PointOfSaleBarcodeScannerSetup(isPresented: $showBarcodeScanningModal, analytics: analytics) + POSBarcodeScannerSetup(isPresented: $showBarcodeScanningModal, analytics: analytics) } .animation(Constants.cartAnimation, value: posModel.cart.isEmpty) .frame(maxWidth: .infinity) diff --git a/Modules/Sources/PointOfSale/Presentation/POSFloatingControlView.swift b/Modules/Sources/PointOfSale/Presentation/POSFloatingControlView.swift index e7c9686304e..7d78b023608 100644 --- a/Modules/Sources/PointOfSale/Presentation/POSFloatingControlView.swift +++ b/Modules/Sources/PointOfSale/Presentation/POSFloatingControlView.swift @@ -55,7 +55,7 @@ struct POSFloatingControlView: View { SimpleProductsOnlyInformation(isPresented: $showProductRestrictionsModal) } .posModal(isPresented: $showBarcodeScanningModal) { - PointOfSaleBarcodeScannerSetup(isPresented: $showBarcodeScanningModal, analytics: analytics) + POSBarcodeScannerSetup(isPresented: $showBarcodeScanningModal, analytics: analytics) } .posFullScreenCover(isPresented: $showOrders) { POSOrdersView(isPresented: $showOrders) diff --git a/Modules/Sources/PointOfSale/Presentation/PointOfSaleEntryPointView.swift b/Modules/Sources/PointOfSale/Presentation/PointOfSaleEntryPointView.swift index f7d96f7894f..1bfb6354870 100644 --- a/Modules/Sources/PointOfSale/Presentation/PointOfSaleEntryPointView.swift +++ b/Modules/Sources/PointOfSale/Presentation/PointOfSaleEntryPointView.swift @@ -33,7 +33,7 @@ public struct PointOfSaleEntryPointView: View { private let couponsSearchController: PointOfSaleSearchingItemsControllerProtocol private let cardPresentPaymentService: CardPresentPaymentFacade private let orderController: PointOfSaleOrderControllerProtocol - private let settingsController: PointOfSaleSettingsControllerProtocol + private let settingsController: POSSettingsControllerProtocol private let collectOrderPaymentAnalyticsTracker: POSCollectOrderPaymentAnalyticsTracking private let searchHistoryService: POSSearchHistoryProviding private let popularPurchasableItemsController: PointOfSaleItemsControllerProtocol diff --git a/Modules/Sources/PointOfSale/Presentation/Reusable Views/POSModalViewModifier.swift b/Modules/Sources/PointOfSale/Presentation/Reusable Views/POSModalViewModifier.swift index efb55522e28..fdf6ed51d82 100644 --- a/Modules/Sources/PointOfSale/Presentation/Reusable Views/POSModalViewModifier.swift +++ b/Modules/Sources/PointOfSale/Presentation/Reusable Views/POSModalViewModifier.swift @@ -251,7 +251,7 @@ extension EnvironmentValues { } } .posModal(isPresented: $showModal) { - PointOfSaleBarcodeScannerSetup(isPresented: $showModal, analytics: EmptyPOSAnalytics()) + POSBarcodeScannerSetup(isPresented: $showModal, analytics: EmptyPOSAnalytics()) } .posRootModal() .environmentObject(modalManager) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift similarity index 97% rename from Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift rename to Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 8dff0f24574..6e485b6fb7d 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -1,13 +1,13 @@ import SwiftUI import struct WooFoundation.SafariView -struct PointOfSaleSettingsHardwareDetailView: View { +struct POSSettingsHardwareDetailView: View { @Environment(PointOfSaleAggregateModel.self) private var posModel @Environment(\.posFeatureFlags) private var featureFlags @Environment(\.dynamicTypeSize) private var dynamicTypeSize @Environment(\.posAnalytics) private var analytics - let settingsController: PointOfSaleSettingsControllerProtocol + let settingsController: POSSettingsControllerProtocol @State private var navigationPath: [NavigationDestination] = [] @State private var showBarcodeScanningSetupModal: Bool = false @@ -82,7 +82,7 @@ struct PointOfSaleSettingsHardwareDetailView: View { } } .posModal(isPresented: $showBarcodeScanningSetupModal) { - PointOfSaleBarcodeScannerSetup(isPresented: $showBarcodeScanningSetupModal, analytics: analytics) + POSBarcodeScannerSetup(isPresented: $showBarcodeScanningSetupModal, analytics: analytics) } .posFullScreenCover(isPresented: $showBarcodeScanningDocumentationModal) { SafariView(url: POSConstants.URLs.pointOfSaleBarcodeScannerDocumentation.asURL()) @@ -92,7 +92,7 @@ struct PointOfSaleSettingsHardwareDetailView: View { } // MARK: - Views -private extension PointOfSaleSettingsHardwareDetailView { +private extension POSSettingsHardwareDetailView { var legacyCardReadersView: some View { VStack(spacing: POSSpacing.none) { POSPageHeaderView( @@ -262,7 +262,7 @@ private extension PointOfSaleSettingsHardwareDetailView { } // MARK: - Navigation -private extension PointOfSaleSettingsHardwareDetailView { +private extension POSSettingsHardwareDetailView { enum HardwareDestination: Identifiable, CaseIterable { case cardReaders case scanners @@ -346,7 +346,7 @@ private extension PointOfSaleSettingsHardwareDetailView { } // MARK: - Constants -private extension PointOfSaleSettingsHardwareDetailView { +private extension POSSettingsHardwareDetailView { enum Localization { static let readerModelTitle = NSLocalizedString( "pointOfSaleSettingsHardwareDetailView.readerModelTitle", @@ -464,6 +464,6 @@ private extension PointOfSaleSettingsHardwareDetailView { #if DEBUG #Preview { - PointOfSaleSettingsHardwareDetailView(settingsController: PointOfSaleSettingsPreviewController()) + POSSettingsHardwareDetailView(settingsController: POSSettingsPreviewController()) } #endif diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsStoreDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsStoreDetailView.swift index 2917b596fe5..1cfd1b0860e 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsStoreDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsStoreDetailView.swift @@ -198,7 +198,7 @@ private extension PointOfSaleSettingsStoreDetailView { #if DEBUG #Preview { - let controller = PointOfSaleSettingsPreviewController() + let controller = POSSettingsPreviewController() PointOfSaleSettingsStoreDetailView(viewModel: controller.storeViewModel) } #endif diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsView.swift index 1458dcd0791..1ed53e3a9e3 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsView.swift @@ -5,7 +5,7 @@ struct PointOfSaleSettingsView: View { @Environment(\.posAnalytics) private var analytics @State private var selection: SidebarNavigation? = .store - let settingsController: PointOfSaleSettingsControllerProtocol + let settingsController: POSSettingsControllerProtocol var body: some View { GeometryReader { geometry in @@ -86,7 +86,7 @@ extension PointOfSaleSettingsView { case .store: PointOfSaleSettingsStoreDetailView(viewModel: settingsController.storeViewModel) case .hardware: - PointOfSaleSettingsHardwareDetailView(settingsController: settingsController) + POSSettingsHardwareDetailView(settingsController: settingsController) case .localCatalog: if let viewModel = settingsController.localCatalogViewModel { POSSettingsLocalCatalogDetailView(viewModel: viewModel) @@ -250,6 +250,6 @@ extension PointOfSaleSettingsView { #if DEBUG #Preview { - PointOfSaleSettingsView(settingsController: PointOfSaleSettingsPreviewController()) + PointOfSaleSettingsView(settingsController: POSSettingsPreviewController()) } #endif diff --git a/Modules/Sources/PointOfSale/Utils/PreviewHelpers.swift b/Modules/Sources/PointOfSale/Utils/PreviewHelpers.swift index 88fbe1c4ff2..2fbf4b9e3b8 100644 --- a/Modules/Sources/PointOfSale/Utils/PreviewHelpers.swift +++ b/Modules/Sources/PointOfSale/Utils/PreviewHelpers.swift @@ -208,7 +208,7 @@ struct POSPreviewHelpers { couponsSearchController: PointOfSaleCouponsControllerProtocol = PointOfSalePreviewCouponsController(), cardPresentPaymentService: CardPresentPaymentFacade = CardPresentPaymentPreviewService(), orderController: PointOfSaleOrderControllerProtocol = PointOfSalePreviewOrderController(), - settingsController: PointOfSaleSettingsControllerProtocol = PointOfSaleSettingsPreviewController(), + settingsController: POSSettingsControllerProtocol = POSSettingsPreviewController(), collectOrderPaymentAnalyticsTracker: POSCollectOrderPaymentAnalyticsTracking = POSCollectOrderPaymentPreviewAnalytics(), searchHistoryService: POSSearchHistoryProviding = PointOfSalePreviewHistoryService(), popularItemsController: PointOfSaleItemsControllerProtocol = PointOfSalePreviewItemsController(), diff --git a/Modules/Tests/PointOfSaleTests/Controllers/PointOfSaleSettingsControllerTests.swift b/Modules/Tests/PointOfSaleTests/Controllers/POSSettingsControllerTests.swift similarity index 96% rename from Modules/Tests/PointOfSaleTests/Controllers/PointOfSaleSettingsControllerTests.swift rename to Modules/Tests/PointOfSaleTests/Controllers/POSSettingsControllerTests.swift index 152cfbc24e9..1de2f9187c6 100644 --- a/Modules/Tests/PointOfSaleTests/Controllers/PointOfSaleSettingsControllerTests.swift +++ b/Modules/Tests/PointOfSaleTests/Controllers/POSSettingsControllerTests.swift @@ -5,7 +5,7 @@ import Foundation import Storage @MainActor -struct PointOfSaleSettingsControllerTests { +struct POSSettingsControllerTests { private let mockSettingsService = MockPointOfSaleSettingsService() private let mockCardPresentPaymentService = MockCardPresentPaymentService() private let mockPluginService = MockPluginsService() @@ -75,7 +75,7 @@ private final class MockPointOfSaleSettingsService: PointOfSaleSettingsServicePr } } -final class MockPointOfSaleSettingsController: PointOfSaleSettingsControllerProtocol { +final class MockPOSSettingsController: POSSettingsControllerProtocol { var connectedCardReader: CardPresentPaymentCardReader? = nil var storeViewModel: POSSettingsStoreViewModel = POSSettingsStoreViewModel(siteID: 123, settingsService: MockPointOfSaleSettingsService(), diff --git a/Modules/Tests/PointOfSaleTests/Models/PointOfSaleAggregateModelTests.swift b/Modules/Tests/PointOfSaleTests/Models/PointOfSaleAggregateModelTests.swift index ed179e65638..e22038b4106 100644 --- a/Modules/Tests/PointOfSaleTests/Models/PointOfSaleAggregateModelTests.swift +++ b/Modules/Tests/PointOfSaleTests/Models/PointOfSaleAggregateModelTests.swift @@ -974,7 +974,7 @@ private func makePointOfSaleAggregateModel( couponsSearchController: PointOfSaleSearchingItemsControllerProtocol = MockPointOfSaleCouponsController(), cardPresentPaymentService: CardPresentPaymentFacade = MockCardPresentPaymentService(), orderController: PointOfSaleOrderControllerProtocol = MockPointOfSaleOrderController(), - settingsController: PointOfSaleSettingsControllerProtocol = MockPointOfSaleSettingsController(), + settingsController: POSSettingsControllerProtocol = MockPOSSettingsController(), analytics: POSAnalyticsProviding = MockPOSAnalytics(), collectOrderPaymentAnalyticsTracker: POSCollectOrderPaymentAnalyticsTracking = MockPOSCollectOrderPaymentAnalyticsTracker(), searchHistoryService: POSSearchHistoryProviding = MockPOSSearchHistoryService(), diff --git a/Modules/Tests/PointOfSaleTests/Presentation/POSItemActionHandlerTests.swift b/Modules/Tests/PointOfSaleTests/Presentation/POSItemActionHandlerTests.swift index c1c1e4433cf..16929a3eac0 100644 --- a/Modules/Tests/PointOfSaleTests/Presentation/POSItemActionHandlerTests.swift +++ b/Modules/Tests/PointOfSaleTests/Presentation/POSItemActionHandlerTests.swift @@ -105,7 +105,7 @@ private func makePointOfSaleAggregateModel( couponsSearchController: PointOfSaleSearchingItemsControllerProtocol = MockPointOfSaleCouponsController(), cardPresentPaymentService: CardPresentPaymentFacade = MockCardPresentPaymentService(), orderController: PointOfSaleOrderControllerProtocol = MockPointOfSaleOrderController(), - settingsController: PointOfSaleSettingsControllerProtocol = MockPointOfSaleSettingsController(), + settingsController: POSSettingsControllerProtocol = MockPOSSettingsController(), analytics: POSAnalyticsProviding = MockPOSAnalytics(), collectOrderPaymentAnalyticsTracker: POSCollectOrderPaymentAnalyticsTracking = MockPOSCollectOrderPaymentAnalyticsTracker(), searchHistoryService: POSSearchHistoryProviding = MockPOSSearchHistoryService(), From d4eca923f3518b6adf39fa7e2771d02e6a4fb482 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 29 Oct 2025 17:20:00 +0700 Subject: [PATCH 3/6] Hook payments onboarding container and payment alert in settings --- .../POSSettingsHardwareDetailView.swift | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 6e485b6fb7d..545e846a2cc 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -36,6 +36,7 @@ struct POSSettingsHardwareDetailView: View { } var body: some View { + @Bindable var posModel = posModel NavigationStack(path: $navigationPath) { POSPageHeaderView(title: Localization.hardwareTitle) .foregroundColor(.posSurface) @@ -81,6 +82,17 @@ struct POSSettingsHardwareDetailView: View { scannersView } } + .posModal(item: $posModel.cardPresentPaymentOnboardingViewContainer, onDismiss: { + // TODO: Dismissal + }, content: { onboardingViewContainer in + paymentsOnboardingView(onboardingViewContainer) + }) + .posModal(item: $posModel.cardPresentPaymentAlertViewModel, onDismiss: { + // TODO: Dismissal + }, content: { alertType in + PointOfSaleCardPresentPaymentAlert(alertType: alertType) + .posInteractiveDismissDisabled(alertType.isDismissDisabled) + }) .posModal(isPresented: $showBarcodeScanningSetupModal) { POSBarcodeScannerSetup(isPresented: $showBarcodeScanningSetupModal, analytics: analytics) } @@ -261,6 +273,21 @@ private extension POSSettingsHardwareDetailView { } } +// MARK: - Reader connection +private extension POSSettingsHardwareDetailView { + func paymentsOnboardingView(_ onboardingViewContainer: CardPresentPaymentOnboardingViewContainer) -> some View { + let viewModel = PointOfSaleCardPresentPaymentOnboardingViewModel(onboardingViewContainer: onboardingViewContainer, onDismissTap: { + // TODO: Handle dismissal + }) + return PointOfSaleCardPresentPaymentOnboardingView(viewModel: viewModel) + .onAppear { + // TODO: Do we need to distinguish here for tracking? + // posModel.trackCardPaymentsOnboardingShown() + } + } +} + + // MARK: - Navigation private extension POSSettingsHardwareDetailView { enum HardwareDestination: Identifiable, CaseIterable { From d27d19796043d3a98da2675a07057aa4970666b1 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 29 Oct 2025 17:35:22 +0700 Subject: [PATCH 4/6] remove onboarding flow temporarily for smaller PR --- .../POSSettingsHardwareDetailView.swift | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 545e846a2cc..9e28f438377 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -82,11 +82,6 @@ struct POSSettingsHardwareDetailView: View { scannersView } } - .posModal(item: $posModel.cardPresentPaymentOnboardingViewContainer, onDismiss: { - // TODO: Dismissal - }, content: { onboardingViewContainer in - paymentsOnboardingView(onboardingViewContainer) - }) .posModal(item: $posModel.cardPresentPaymentAlertViewModel, onDismiss: { // TODO: Dismissal }, content: { alertType in @@ -273,21 +268,6 @@ private extension POSSettingsHardwareDetailView { } } -// MARK: - Reader connection -private extension POSSettingsHardwareDetailView { - func paymentsOnboardingView(_ onboardingViewContainer: CardPresentPaymentOnboardingViewContainer) -> some View { - let viewModel = PointOfSaleCardPresentPaymentOnboardingViewModel(onboardingViewContainer: onboardingViewContainer, onDismissTap: { - // TODO: Handle dismissal - }) - return PointOfSaleCardPresentPaymentOnboardingView(viewModel: viewModel) - .onAppear { - // TODO: Do we need to distinguish here for tracking? - // posModel.trackCardPaymentsOnboardingShown() - } - } -} - - // MARK: - Navigation private extension POSSettingsHardwareDetailView { enum HardwareDestination: Identifiable, CaseIterable { From 85fc3e9916ee89fb7ba16dcc6032c1fb6c4cc252 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 29 Oct 2025 17:36:47 +0700 Subject: [PATCH 5/6] forward modal dismissal to viewmodel --- .../Presentation/Settings/POSSettingsHardwareDetailView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 9e28f438377..97b5d30dc19 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -83,7 +83,7 @@ struct POSSettingsHardwareDetailView: View { } } .posModal(item: $posModel.cardPresentPaymentAlertViewModel, onDismiss: { - // TODO: Dismissal + posModel.cardPresentPaymentAlertViewModel?.onDismiss?() }, content: { alertType in PointOfSaleCardPresentPaymentAlert(alertType: alertType) .posInteractiveDismissDisabled(alertType.isDismissDisabled) From 3b4822de959cd1efc72c12f84770e9ca56d27171 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 30 Oct 2025 11:14:48 +0700 Subject: [PATCH 6/6] remove unnecessary double access control --- .../Presentation/Settings/POSSettingsHardwareDetailView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 97b5d30dc19..0ae42ddcff4 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -342,7 +342,7 @@ private extension POSSettingsHardwareDetailView { } } - private func handleScannerDestination(_ destination: ScannerDestination) { + func handleScannerDestination(_ destination: ScannerDestination) { switch destination { case .setup: showBarcodeScanningSetupModal = true