From e65fc5b01c980ccb392b9292ac6e28f5d0d013f3 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Tue, 4 Nov 2025 16:14:49 +0700 Subject: [PATCH 1/8] use Vstack rather than List to remove oddness when tapping --- .../POSSettingsHardwareDetailView.swift | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index e616dbd3f57..1ab320b021e 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -40,37 +40,37 @@ struct POSSettingsHardwareDetailView: View { var body: some View { @Bindable var posModel = posModel NavigationStack(path: $navigationPath) { - POSPageHeaderView(title: Localization.hardwareTitle) - .foregroundColor(.posSurface) - .accessibilityAddTraits(.isHeader) - - List(HardwareDestination.allCases) { destination in - NavigationLink(value: NavigationDestination.hardware(destination)) { - HStack(spacing: POSSpacing.medium) { - Image(systemName: destination.icon) - .font(.posBodyLargeRegular()) - .accessibilityHidden(true) - .renderedIf(!dynamicTypeSize.isAccessibilitySize) - - VStack(alignment: .leading, spacing: POSPadding.xSmall) { - Text(destination.title) - .font(.posBodyLargeRegular()) - .dynamicTypeSize(...DynamicTypeSize.accessibility2) - Text(destination.subtitle) - .font(.posBodyMediumRegular()) - .foregroundStyle(.secondary) - .dynamicTypeSize(...DynamicTypeSize.accessibility2) + VStack(spacing: POSSpacing.none) { + POSPageHeaderView(title: Localization.hardwareTitle) + .foregroundColor(.posSurface) + .accessibilityAddTraits(.isHeader) + + VStack(spacing: POSSpacing.small) { + ForEach(HardwareDestination.allCases) { destination in + NavigationLink(value: NavigationDestination.hardware(destination)) { + VStack(alignment: .leading, spacing: POSPadding.xSmall) { + Text(destination.title) + .font(.posBodyLargeBold) + .foregroundStyle(Color.posOnSurface) + .dynamicTypeSize(...DynamicTypeSize.accessibility2) + Text(destination.subtitle) + .font(.posBodyMediumRegular()) + .foregroundStyle(.secondary) + .dynamicTypeSize(...DynamicTypeSize.accessibility2) + } + .padding() + .frame(maxWidth: .infinity, alignment: .leading) + .background(Color.posSurfaceContainerLowest) + .posItemCardBorderStyles() } - Spacer() + .accessibilityLabel("\(destination.title), \(destination.subtitle)") } } - .listRowSeparator(.hidden) + .padding(.horizontal, POSPadding.medium) + + Spacer() } - .listStyle(.plain) - .scrollContentBackground(.hidden) .background(backgroundColor) - .listRowBackground(Color.clear) - .listRowSeparator(.hidden) .navigationDestination(for: NavigationDestination.self) { destination in switch destination { case .hardware(.cardReaders): From a0faa8cc4c9e87537012e155f723f52ac1c331d6 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Tue, 4 Nov 2025 16:17:09 +0700 Subject: [PATCH 2/8] prevent NavigationLink from applying its default text color styling --- .../Presentation/Settings/POSSettingsHardwareDetailView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 1ab320b021e..c83176aea1f 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -63,6 +63,7 @@ struct POSSettingsHardwareDetailView: View { .background(Color.posSurfaceContainerLowest) .posItemCardBorderStyles() } + .buttonStyle(.plain) .accessibilityLabel("\(destination.title), \(destination.subtitle)") } } From 48a07479631469915cffe846d05c586c44d38984 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Tue, 4 Nov 2025 16:19:13 +0700 Subject: [PATCH 3/8] remove legacyCardReadersView --- .../POSSettingsHardwareDetailView.swift | 76 +------------------ 1 file changed, 1 insertion(+), 75 deletions(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index c83176aea1f..50132cd02cd 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -75,12 +75,7 @@ struct POSSettingsHardwareDetailView: View { .navigationDestination(for: NavigationDestination.self) { destination in switch destination { case .hardware(.cardReaders): - if featureFlags.isFeatureFlagEnabled(.pointOfSaleSettingsCardReaderFlow) { - cardReadersView - } else { - // TODO: Legacy view to be removed along feature flag on WOOMOB-1591 - legacyCardReadersView - } + cardReadersView case .hardware(.scanners): scannersView } @@ -142,75 +137,6 @@ private extension POSSettingsHardwareDetailView { .navigationViewStyle(.stack) } - var legacyCardReadersView: some View { - VStack(spacing: POSSpacing.none) { - POSPageHeaderView( - title: Localization.cardReadersTitle, - backButtonConfiguration: .init(state: .enabled, action: { - navigationPath.removeLast() - }, buttonIcon: "chevron.left")) - .foregroundColor(.posSurface) - - List { - VStack(spacing: POSPadding.xSmall) { - HStack { - Text(Localization.readerModelTitle) - .font(.posBodyMediumRegular()) - .foregroundStyle(.primary) - Spacer() - Text(cardReaderName) - .font(.posBodyMediumRegular()) - .foregroundStyle(.secondary) - } - .padding() - HStack { - Text(Localization.readerBatteryTitle) - .font(.posBodyMediumRegular()) - .foregroundStyle(.primary) - Spacer() - Text(formattedBatteryLevel) - .font(.posBodyMediumRegular()) - .foregroundStyle(.secondary) - } - .padding() - } - Button { - showCardReaderDocumentationModal = true - } label: { - HStack(spacing: POSSpacing.medium) { - Image(systemName: "doc.text") - .font(.posBodyLargeRegular()) - .accessibilityHidden(true) - .renderedIf(!dynamicTypeSize.isAccessibilitySize) - - VStack(alignment: .leading, spacing: POSPadding.xSmall) { - Text(Localization.cardReaderDocumentationTitle) - .font(.posBodyLargeRegular()) - .dynamicTypeSize(...DynamicTypeSize.accessibility2) - Text(Localization.cardReaderDocumentationSubtitle) - .font(.posBodyMediumRegular()) - .foregroundStyle(.secondary) - .dynamicTypeSize(...DynamicTypeSize.accessibility2) - } - Spacer() - } - } - .padding() - .accessibilityAddTraits(.isButton) - .listRowSeparator(.hidden) - } - .listStyle(.plain) - .scrollContentBackground(.hidden) - .listRowBackground(Color.clear) - .background(backgroundColor) - .foregroundColor(.posOnSurface) - } - .navigationBarBackButtonHidden(true) - .posFullScreenCover(isPresented: $showCardReaderDocumentationModal) { - SafariView(url: POSConstants.URLs.inPersonPaymentsLearnMoreWCPay.asURL()) - } - } - var cardReadersView: some View { VStack(spacing: POSSpacing.none) { POSPageHeaderView( From 9a4a36096da9b2461f0a8d558c7589a0e943784f Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Tue, 4 Nov 2025 16:22:56 +0700 Subject: [PATCH 4/8] update scannersView --- .../POSSettingsHardwareDetailView.swift | 39 +++++++------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 50132cd02cd..ee86aab9d51 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -204,36 +204,23 @@ private extension POSSettingsHardwareDetailView { }, buttonIcon: "chevron.left")) .foregroundColor(.posSurface) - List(ScannerDestination.allCases) { destination in - Button { - handleScannerDestination(destination) - } label: { - HStack(spacing: POSSpacing.medium) { - Image(systemName: destination.icon) - .font(.posBodyLargeRegular()) - .accessibilityHidden(true) - .renderedIf(!dynamicTypeSize.isAccessibilitySize) - VStack(alignment: .leading, spacing: POSPadding.xSmall) { - Text(destination.title) - .font(.posBodyLargeRegular()) - .dynamicTypeSize(...DynamicTypeSize.accessibility2) - Text(destination.subtitle) - .font(.posBodyMediumRegular()) - .foregroundStyle(.secondary) - .dynamicTypeSize(...DynamicTypeSize.accessibility2) + VStack(spacing: POSSpacing.small) { + ForEach(ScannerDestination.allCases) { destination in + POSSettingsCardView( + title: destination.title, + subtitle: destination.subtitle, + isSelected: false, + action: { + handleScannerDestination(destination) } - Spacer() - } + ) } - .accessibilityAddTraits(.isButton) - .listRowSeparator(.hidden) } - .listStyle(.plain) - .scrollContentBackground(.hidden) - .listRowBackground(Color.clear) - .background(backgroundColor) - .foregroundColor(.posOnSurface) + .padding(.horizontal, POSPadding.medium) + + Spacer() } + .background(backgroundColor) .navigationBarBackButtonHidden(true) } } From ed3171526902005a9a3c8a8941f851a2c653f4d8 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Tue, 4 Nov 2025 16:34:05 +0700 Subject: [PATCH 5/8] make isSelected default to false --- .../Settings/POSSettingsCardView.swift | 27 ++++++++++++++----- .../POSSettingsHardwareDetailView.swift | 3 --- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCardView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCardView.swift index 6d26982ad1f..ada826713b3 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCardView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCardView.swift @@ -6,6 +6,13 @@ struct POSSettingsCardView: View { let isSelected: Bool let action: () -> Void + init(title: String, subtitle: String, isSelected: Bool = false, action: @escaping () -> Void) { + self.title = title + self.subtitle = subtitle + self.isSelected = isSelected + self.action = action + } + var body: some View { Button(action: action) { VStack(alignment: .leading, spacing: POSPadding.xSmall) { @@ -36,11 +43,19 @@ struct POSSettingsCardView: View { #if DEBUG #Preview { - POSSettingsCardView( - title: "Documentation", - subtitle: "Learn more about accepting mobile payments", - isSelected: true, - action: { } - ) + VStack { + POSSettingsCardView( + title: "Documentation", + subtitle: "Learn more about accepting mobile payments", + isSelected: true, + action: { } + ) + POSSettingsCardView( + title: "Documentation", + subtitle: "Learn more about accepting mobile payments", + isSelected: false, + action: { } + ) + } } #endif diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index ee86aab9d51..c201237637e 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -170,7 +170,6 @@ private extension POSSettingsHardwareDetailView { } else { POSSettingsCardView(title: Localization.cardReaderConnectTitle, subtitle: Localization.cardReaderConnectSubtitle, - isSelected: false, // Temporary. Update with WOOMOB-1571 action: { posModel.connectCardReader() }) @@ -178,7 +177,6 @@ private extension POSSettingsHardwareDetailView { POSSettingsCardView(title: Localization.cardReaderDocumentationTitle, subtitle: Localization.cardReaderDocumentationSubtitle, - isSelected: false, // Temporary. Update with WOOMOB-1571 action: { showCardReaderDocumentationModal = true }) .accessibilityAddTraits(.isButton) .listRowSeparator(.hidden) @@ -209,7 +207,6 @@ private extension POSSettingsHardwareDetailView { POSSettingsCardView( title: destination.title, subtitle: destination.subtitle, - isSelected: false, action: { handleScannerDestination(destination) } From 2841333c11fd06f51846f9b2eb4a0ba986bafd3d Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Tue, 4 Nov 2025 16:46:42 +0700 Subject: [PATCH 6/8] remove unused --- .../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 c201237637e..419786be47c 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -3,8 +3,6 @@ import struct WooFoundation.SafariView struct POSSettingsHardwareDetailView: View { @Environment(PointOfSaleAggregateModel.self) private var posModel - @Environment(\.posFeatureFlags) private var featureFlags - @Environment(\.dynamicTypeSize) private var dynamicTypeSize @Environment(\.posAnalytics) private var analytics @Environment(\.posExternalViews) private var externalViews @@ -247,15 +245,6 @@ private extension POSSettingsHardwareDetailView { return Localization.hardwareNavigationBarcodeSubtitle } } - - var icon: String { - switch self { - case .cardReaders: - return "creditcard" - case .scanners: - return "qrcode.viewfinder" - } - } } enum NavigationDestination: Hashable { @@ -285,15 +274,6 @@ private extension POSSettingsHardwareDetailView { return Localization.scannerDocumentationSubtitle } } - - var icon: String { - switch self { - case .setup: - return "gearshape" - case .documentation: - return "doc.text" - } - } } func handleScannerDestination(_ destination: ScannerDestination) { From c6cb1df0de6c5d26544ae618bf311d004f1f14fc Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 5 Nov 2025 11:47:11 +0700 Subject: [PATCH 7/8] rename POSSettingsCard --- .../{POSSettingsCardView.swift => POSSettingsCard.swift} | 6 +++--- .../Settings/POSSettingsHardwareDetailView.swift | 6 +++--- .../PointOfSale/Presentation/Settings/POSSettingsView.swift | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) rename Modules/Sources/PointOfSale/Presentation/Settings/{POSSettingsCardView.swift => POSSettingsCard.swift} (94%) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCardView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCard.swift similarity index 94% rename from Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCardView.swift rename to Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCard.swift index ada826713b3..fc88735af0b 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCardView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsCard.swift @@ -1,6 +1,6 @@ import SwiftUI -struct POSSettingsCardView: View { +struct POSSettingsCard: View { let title: String let subtitle: String let isSelected: Bool @@ -44,13 +44,13 @@ struct POSSettingsCardView: View { #if DEBUG #Preview { VStack { - POSSettingsCardView( + POSSettingsCard( title: "Documentation", subtitle: "Learn more about accepting mobile payments", isSelected: true, action: { } ) - POSSettingsCardView( + POSSettingsCard( title: "Documentation", subtitle: "Learn more about accepting mobile payments", isSelected: false, diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index 419786be47c..bc35b1ccfb9 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -166,14 +166,14 @@ private extension POSSettingsHardwareDetailView { } .font(.posBodyMediumRegular()) } else { - POSSettingsCardView(title: Localization.cardReaderConnectTitle, + POSSettingsCard(title: Localization.cardReaderConnectTitle, subtitle: Localization.cardReaderConnectSubtitle, action: { posModel.connectCardReader() }) } - POSSettingsCardView(title: Localization.cardReaderDocumentationTitle, + POSSettingsCard(title: Localization.cardReaderDocumentationTitle, subtitle: Localization.cardReaderDocumentationSubtitle, action: { showCardReaderDocumentationModal = true }) .accessibilityAddTraits(.isButton) @@ -202,7 +202,7 @@ private extension POSSettingsHardwareDetailView { VStack(spacing: POSSpacing.small) { ForEach(ScannerDestination.allCases) { destination in - POSSettingsCardView( + POSSettingsCard( title: destination.title, subtitle: destination.subtitle, action: { diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsView.swift index b9313a5ae20..d6e8455251b 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsView.swift @@ -36,14 +36,14 @@ extension POSSettingsView { .accessibilityAddTraits(.isHeader) VStack(spacing: POSSpacing.small) { - POSSettingsCardView(title: POSSettingsView.SidebarNavigation.store.title, + POSSettingsCard(title: POSSettingsView.SidebarNavigation.store.title, subtitle: POSSettingsView.SidebarNavigation.store.subtitle, isSelected: selection == .store, action: { analytics.track(.pointOfSaleSettingsStoreDetailsTapped) selection = .store }) - POSSettingsCardView(title: POSSettingsView.SidebarNavigation.hardware.title, + POSSettingsCard(title: POSSettingsView.SidebarNavigation.hardware.title, subtitle: POSSettingsView.SidebarNavigation.hardware.subtitle, isSelected: selection == .hardware, action: { @@ -51,7 +51,7 @@ extension POSSettingsView { selection = .hardware }) if settingsController.isLocalCatalogEligible { - POSSettingsCardView(title: POSSettingsView.SidebarNavigation.localCatalog.title, + POSSettingsCard(title: POSSettingsView.SidebarNavigation.localCatalog.title, subtitle: POSSettingsView.SidebarNavigation.localCatalog.subtitle, isSelected: selection == .localCatalog, action: { From 857b94853e16ff19c97effae98a46f1c0c8f1c0a Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 5 Nov 2025 11:52:47 +0700 Subject: [PATCH 8/8] Update NavigationView usage to NavigationStack --- .../Presentation/Settings/POSSettingsHardwareDetailView.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift index bc35b1ccfb9..34a893645a1 100644 --- a/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift +++ b/Modules/Sources/PointOfSale/Presentation/Settings/POSSettingsHardwareDetailView.swift @@ -122,7 +122,7 @@ private extension POSSettingsHardwareDetailView { } var supportForm: some View { - NavigationView { + NavigationStack { externalViews.createSupportFormView(isPresented: $showSupport, sourceTag: Constants.supportTag) .toolbar { ToolbarItem(placement: .cancellationAction) { @@ -132,7 +132,6 @@ private extension POSSettingsHardwareDetailView { } } } - .navigationViewStyle(.stack) } var cardReadersView: some View {