Skip to content

Commit 87a9ef1

Browse files
committed
present settings view through CTA button
1 parent bf3bb02 commit 87a9ef1

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

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: 22 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
@@ -290,3 +295,19 @@ private extension PointOfSaleDashboardView {
290295
}
291296

292297
#endif
298+
299+
struct PointOfSaleSettingsView: View {
300+
@Environment(\.dismiss) private var dismiss
301+
var body: some View {
302+
NavigationView {
303+
Text("Settings")
304+
.toolbar {
305+
ToolbarItem(placement: .navigationBarTrailing) {
306+
Button("Done") {
307+
dismiss()
308+
}
309+
}
310+
}
311+
}
312+
}
313+
}

0 commit comments

Comments
 (0)