Skip to content

Commit 047ccd8

Browse files
authored
[POS Settings] Feature flag and present settings view (#16009)
2 parents fc02c50 + fe941c1 commit 047ccd8

File tree

6 files changed

+69
-5
lines changed

6 files changed

+69
-5
lines changed

Modules/Sources/Experiments/DefaultFeatureFlagService.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
103103
return true
104104
case .pointOfSaleBarcodeScanningi2:
105105
return true
106+
case .pointOfSaleSettingsi1:
107+
return false
106108
case .orderAddressMapSearch:
107109
return true
108110
default:

Modules/Sources/Experiments/FeatureFlag.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public enum FeatureFlag: Int {
211211
///
212212
case pointOfSaleBarcodeScanningi2
213213

214+
/// Enables the entry point for Point of Sale Settings
215+
///
216+
case pointOfSaleSettingsi1
217+
214218
/// Enables the CTA to search for an address in the map in order details > shipping address.
215219
///
216220
case orderAddressMapSearch

WooCommerce/Classes/POS/Presentation/POSFloatingControlView.swift

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ struct POSFloatingControlView: View {
88
@Binding private var showExitPOSModal: Bool
99
@Binding private var showSupport: Bool
1010
@Binding private var showDocumentation: Bool
11+
@Binding private var showSettings: Bool
1112
@State private var showProductRestrictionsModal: Bool = false
1213
@State private var showBarcodeScanningModal: Bool = false
1314

1415
init(showExitPOSModal: Binding<Bool>,
1516
showSupport: Binding<Bool>,
16-
showDocumentation: Binding<Bool>) {
17+
showDocumentation: Binding<Bool>,
18+
showSettings: Binding<Bool>) {
1719
self._showExitPOSModal = showExitPOSModal
1820
self._showSupport = showSupport
1921
self._showDocumentation = showDocumentation
22+
self._showSettings = showSettings
2023
}
2124

2225
var body: some View {
@@ -73,6 +76,16 @@ struct POSFloatingControlView: View {
7376
icon: { Image(systemName: "barcode.viewfinder") })
7477
}
7578
}
79+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleSettingsi1) {
80+
Button {
81+
showSettings = true
82+
} label: {
83+
Label(
84+
title: { Text(Localization.settings) },
85+
icon: { Image(systemName: "gearshape") }
86+
)
87+
}
88+
}
7689
} label: {
7790
VStack {
7891
Spacer()
@@ -185,14 +198,23 @@ private extension POSFloatingControlView {
185198
value: "Initial barcode scanner setup",
186199
comment: "The title of the menu button to start a barcode scanner setup flow."
187200
)
201+
202+
static let settings = NSLocalizedString(
203+
"pointOfSale.floatingButtons.settings.button.title",
204+
value: "Settings",
205+
comment: "The title of the menu button to access Point of Sale settings."
206+
)
188207
}
189208
}
190209

191210
#if DEBUG
192211

193212
@available(iOS 17.0, *)
194213
#Preview("Reader Disconnected") {
195-
POSFloatingControlView(showExitPOSModal: .constant(false), showSupport: .constant(false), showDocumentation: .constant(false))
214+
POSFloatingControlView(showExitPOSModal: .constant(false),
215+
showSupport: .constant(false),
216+
showDocumentation: .constant(false),
217+
showSettings: .constant(false))
196218
.environment(\.posBackgroundAppearance, .primary)
197219
.environment(POSPreviewHelpers.makePreviewAggregateModel())
198220
}
@@ -204,14 +226,20 @@ private extension POSFloatingControlView {
204226
let posModel = POSPreviewHelpers.makePreviewAggregateModel(
205227
cardPresentPaymentService: paymentService
206228
)
207-
return POSFloatingControlView(showExitPOSModal: .constant(false), showSupport: .constant(false), showDocumentation: .constant(false))
229+
return POSFloatingControlView(showExitPOSModal: .constant(false),
230+
showSupport: .constant(false),
231+
showDocumentation: .constant(false),
232+
showSettings: .constant(false))
208233
.environment(\.posBackgroundAppearance, .primary)
209234
.environment(posModel)
210235
}
211236

212237
@available(iOS 17.0, *)
213238
#Preview("Secondary/disabled Background") {
214-
POSFloatingControlView(showExitPOSModal: .constant(false), showSupport: .constant(false), showDocumentation: .constant(false))
239+
POSFloatingControlView(showExitPOSModal: .constant(false),
240+
showSupport: .constant(false),
241+
showDocumentation: .constant(false),
242+
showSettings: .constant(false))
215243
.environment(\.posBackgroundAppearance, .secondary)
216244
.environment(POSPreviewHelpers.makePreviewAggregateModel())
217245
}

WooCommerce/Classes/POS/Presentation/PointOfSaleDashboardView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct PointOfSaleDashboardView: View {
88
@State private var showExitPOSModal: Bool = false
99
@State private var showSupport: Bool = false
1010
@State private var showDocumentation: Bool = false
11+
@State private var showSettings: Bool = false
1112
@State private var waitingTimeTracker: WaitingTimeTracker?
1213

1314
@State private var floatingSize: CGSize = .zero
@@ -90,7 +91,8 @@ struct PointOfSaleDashboardView: View {
9091

9192
POSFloatingControlView(showExitPOSModal: $showExitPOSModal,
9293
showSupport: $showSupport,
93-
showDocumentation: $showDocumentation)
94+
showDocumentation: $showDocumentation,
95+
showSettings: $showSettings)
9496
.offset(x: Constants.floatingControlHorizontalOffset, y: -Constants.floatingControlVerticalOffset)
9597
.padding(.bottom, Constants.floatingControlBottomPadding)
9698
.trackSize(size: $floatingSize)
@@ -130,6 +132,9 @@ struct PointOfSaleDashboardView: View {
130132
.posSheet(isPresented: $showDocumentation) {
131133
documentationView
132134
}
135+
.posFullScreenCover(isPresented: $showSettings) {
136+
PointOfSaleSettingsView()
137+
}
133138
.onChange(of: posModel.entryPointController.eligibilityState) { oldValue, newValue in
134139
guard newValue == .eligible else { return }
135140
Task { @MainActor in
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import SwiftUI
2+
3+
struct PointOfSaleSettingsView: View {
4+
@Environment(\.dismiss) private var dismiss
5+
var body: some View {
6+
NavigationView {
7+
Text("Settings")
8+
.toolbar {
9+
ToolbarItem(placement: .navigationBarTrailing) {
10+
Button("Done") {
11+
dismiss()
12+
}
13+
}
14+
}
15+
}
16+
}
17+
}
18+
19+
#Preview {
20+
PointOfSaleSettingsView()
21+
}

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,7 @@
15791579
683988A72C7D82E70084B85A /* POSHeaderLayoutConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 683988A62C7D82E60084B85A /* POSHeaderLayoutConstants.swift */; };
15801580
683AA9D62A303CB70099F7BA /* UpgradesViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 683AA9D52A303CB70099F7BA /* UpgradesViewModelTests.swift */; };
15811581
683AC4AC2CEF019A00FF0A5E /* POSSendReceiptView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 683AC4AB2CEF019700FF0A5E /* POSSendReceiptView.swift */; };
1582+
683D41182E4D9B570024CFE4 /* PointOfSaleSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 683D41172E4D9B570024CFE4 /* PointOfSaleSettingsView.swift */; };
15821583
683DF5FF2C6AF46500A5CDC6 /* POSHeaderTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 683DF5FE2C6AF46500A5CDC6 /* POSHeaderTitleView.swift */; };
15831584
684AB83A2870677F003DFDD1 /* CardReaderManualsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684AB8392870677F003DFDD1 /* CardReaderManualsView.swift */; };
15841585
684AB83C2873DF04003DFDD1 /* CardReaderManualsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684AB83B2873DF04003DFDD1 /* CardReaderManualsViewModel.swift */; };
@@ -4753,6 +4754,7 @@
47534754
683988A62C7D82E60084B85A /* POSHeaderLayoutConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = POSHeaderLayoutConstants.swift; sourceTree = "<group>"; };
47544755
683AA9D52A303CB70099F7BA /* UpgradesViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpgradesViewModelTests.swift; sourceTree = "<group>"; };
47554756
683AC4AB2CEF019700FF0A5E /* POSSendReceiptView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = POSSendReceiptView.swift; sourceTree = "<group>"; };
4757+
683D41172E4D9B570024CFE4 /* PointOfSaleSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointOfSaleSettingsView.swift; sourceTree = "<group>"; };
47564758
683DF5FE2C6AF46500A5CDC6 /* POSHeaderTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = POSHeaderTitleView.swift; sourceTree = "<group>"; };
47574759
684AB8392870677F003DFDD1 /* CardReaderManualsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardReaderManualsView.swift; sourceTree = "<group>"; };
47584760
684AB83B2873DF04003DFDD1 /* CardReaderManualsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardReaderManualsViewModel.swift; sourceTree = "<group>"; };
@@ -7177,6 +7179,7 @@
71777179
68A345632D029E09002EE324 /* PaymentButtons.swift */,
71787180
026826A52BF59DF60036F959 /* PointOfSaleDashboardView.swift */,
71797181
68E141DA2D13107200A70D5B /* PointOfSaleCollectCashView.swift */,
7182+
683D41172E4D9B570024CFE4 /* PointOfSaleSettingsView.swift */,
71807183
DA013F502C65125100D9A391 /* PointOfSaleExitPosAlertView.swift */,
71817184
DA0DBE2E2C4FC61D00DF14C0 /* POSFloatingControlView.swift */,
71827185
20D3D42A2C64D7CC004CE6E3 /* SimpleProductsOnlyInformation.swift */,
@@ -15330,6 +15333,7 @@
1533015333
01BE94042DDCC7670063541C /* PointOfSaleEmptyErrorStateViewLayout.swift in Sources */,
1533115334
029106C02BE3349500C2248B /* OrderCustomerSectionViewModel.swift in Sources */,
1533215335
74460D4022289B7600D7316A /* Coordinator.swift in Sources */,
15336+
683D41182E4D9B570024CFE4 /* PointOfSaleSettingsView.swift in Sources */,
1533315337
205E79422C1CA6E3001BA266 /* PointOfSaleCardPresentPaymentEventPresentationStyle.swift in Sources */,
1533415338
EE4C45842C381BAA001A3D94 /* PackagePhotoView.swift in Sources */,
1533515339
B57C743D20F5493300EEFC87 /* AccountHeaderView.swift in Sources */,

0 commit comments

Comments
 (0)