Skip to content

Commit 06b6a08

Browse files
authored
[Woo POS][Historical Orders] Feature flag and entry point (#16022)
2 parents 732cda3 + ad2a3d7 commit 06b6a08

File tree

5 files changed

+34
-92
lines changed

5 files changed

+34
-92
lines changed

Modules/Sources/Experiments/DefaultFeatureFlagService.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
8888
return true
8989
case .productImageOptimizedHandling:
9090
return true
91-
case .pointOfSaleBarcodeScanningi1:
92-
return true
93-
case .showPointOfSaleBarcodeSimulator:
94-
// Enables a simulated barcode scanner in dev builds for testing. Do not ship this one!
95-
return false
9691
case .pointOfSaleAsATabi1:
9792
return true
9893
case .pointOfSaleAsATabi2:
@@ -101,12 +96,12 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
10196
return true
10297
case .pointOfSaleOrdersi2:
10398
return true
104-
case .pointOfSaleBarcodeScanningi2:
105-
return true
10699
case .pointOfSaleSettingsi1:
107100
return false
108101
case .orderAddressMapSearch:
109102
return true
103+
case .pointOfSaleHistoricalOrdersi1:
104+
return buildConfig == .localDeveloper || buildConfig == .alpha
110105
default:
111106
return true
112107
}

Modules/Sources/Experiments/FeatureFlag.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,6 @@ public enum FeatureFlag: Int {
183183
///
184184
case pointOfSaleReceipts
185185

186-
/// Enables barcode scanning with an external scanner in POS
187-
///
188-
case pointOfSaleBarcodeScanningi1
189-
190-
/// Enables a simulated barcode scanner for testing in POS. Do not ship this one!
191-
///
192-
case showPointOfSaleBarcodeSimulator
193-
194186
/// Enables displaying POS as a tab in the tab bar with the same eligibility as the previous entry point
195187
///
196188
case pointOfSaleAsATabi1
@@ -207,15 +199,15 @@ public enum FeatureFlag: Int {
207199
///
208200
case pointOfSaleOrdersi2
209201

210-
/// Enables the Point of Sale Barcode Scanner set up flows, as part of i2
211-
///
212-
case pointOfSaleBarcodeScanningi2
213-
214202
/// Enables the entry point for Point of Sale Settings
215203
///
216204
case pointOfSaleSettingsi1
217205

218206
/// Enables the CTA to search for an address in the map in order details > shipping address.
219207
///
220208
case orderAddressMapSearch
209+
210+
/// Enables the entry point for Point of Sale Orders
211+
///
212+
case pointOfSaleHistoricalOrdersi1
221213
}

WooCommerce/Classes/POS/Presentation/Barcode Scanning/BarcodeScanningModifier.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ struct BarcodeScanningModifier: ViewModifier {
99
/// Callback that is triggered when a barcode is successfully scanned
1010
let onScan: (Result<String, HIDBarcodeParserError>) -> Void
1111

12-
private var isBarcodeScani1FeatureEnabled: Bool {
13-
ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleBarcodeScanningi1)
14-
}
15-
1612
func body(content: Content) -> some View {
1713
ZStack {
1814
content
1915

20-
if enabled && isBarcodeScani1FeatureEnabled {
16+
if enabled {
2117
BarcodeScannerContainer(onScan: onScan)
2218
}
2319
}

WooCommerce/Classes/POS/Presentation/ItemListView.swift

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,6 @@ struct ItemListView: View {
5151
@State private var searchTask: Task<Void, Never>?
5252
@State private var didFinishSearch = true
5353

54-
private var isBarcodeScani1FeatureEnabled: Bool {
55-
ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleBarcodeScanningi1)
56-
}
57-
58-
private var isBarcodeScanSimulatorEnabled: Bool {
59-
ServiceLocator.featureFlagService.isFeatureFlagEnabled(.showPointOfSaleBarcodeSimulator)
60-
}
61-
6254
private var isAddingCouponAllowed: Bool {
6355
guard case .coupons = selectedItemListType else { return false }
6456
let itemListState = itemListState(selectedItemListType)
@@ -71,9 +63,6 @@ struct ItemListView: View {
7163

7264
@State private var showCouponCreationModal: Bool = false
7365

74-
@State private var barcodeScanSimulatorIsPresented: Bool = false
75-
@State private var barcodeScanSimulatorText: String = ""
76-
7766
var body: some View {
7867
if #available(iOS 18.0, *) {
7968
NavigationStack {
@@ -244,9 +233,6 @@ private extension ItemListView {
244233
} else {
245234
createCouponButton
246235

247-
simulatedScanButton
248-
.renderedIf(isBarcodeScanSimulatorEnabled && isBarcodeScani1FeatureEnabled)
249-
250236
POSPageHeaderActionButton(systemName: "magnifyingglass") {
251237
analyticsTracker.trackSearchTapped(itemListType: selectedItemListType)
252238
setSearch(true)
@@ -256,9 +242,6 @@ private extension ItemListView {
256242

257243
}
258244
})
259-
260-
barcodeScanSimulator
261-
.renderedIf(barcodeScanSimulatorIsPresented)
262245
}
263246
.animation(.easeInOut(duration: Constants.animationDuration), value: isSearching)
264247
.animation(.easeInOut(duration: Constants.animationDuration), value: isAddingCouponAllowed)
@@ -307,31 +290,6 @@ private extension ItemListView {
307290
.transition(.opacity.combined(with: .scale))
308291
}
309292

310-
@ViewBuilder
311-
private var simulatedScanButton: some View {
312-
POSPageHeaderActionButton(systemName: "barcode") {
313-
barcodeScanSimulatorIsPresented.toggle()
314-
}
315-
.transition(.opacity.combined(with: .scale))
316-
}
317-
318-
@ViewBuilder
319-
private var barcodeScanSimulator: some View {
320-
HStack {
321-
TextField(text: $barcodeScanSimulatorText) {
322-
Text("Barcode value")
323-
}
324-
325-
Button {
326-
posModel.barcodeScanned(.success(barcodeScanSimulatorText))
327-
} label: {
328-
Text("Scan!")
329-
}
330-
.buttonStyle(POSFilledButtonStyle(size: .extraSmall))
331-
}
332-
.padding([.bottom, .horizontal], 16)
333-
}
334-
335293
@ViewBuilder
336294
var emptyView: some View {
337295
switch selectedItemListType {

WooCommerce/Classes/POS/Presentation/POSFloatingControlView.swift

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,15 @@ struct POSFloatingControlView: View {
6060
title: { Text(Localization.productRestrictionsInfo) },
6161
icon: { Image(systemName: "magnifyingglass") })
6262
}
63-
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleBarcodeScanningi1) {
64-
Button {
65-
showBarcodeScanningModal = true
66-
ServiceLocator.analytics.track(.pointOfSaleBarcodeScanningMenuItemTapped)
67-
} label: {
68-
Label(
69-
title: {
70-
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleBarcodeScanningi2) {
71-
Text(Localization.barcodeScanningSetup)
72-
} else {
73-
Text(Localization.barcodeScanning)
74-
}
75-
},
76-
icon: { Image(systemName: "barcode.viewfinder") })
77-
}
63+
Button {
64+
showBarcodeScanningModal = true
65+
ServiceLocator.analytics.track(.pointOfSaleBarcodeScanningMenuItemTapped)
66+
} label: {
67+
Label(
68+
title: {
69+
Text(Localization.barcodeScanningSetup)
70+
},
71+
icon: { Image(systemName: "barcode.viewfinder") })
7872
}
7973
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleSettingsi1) {
8074
Button {
@@ -86,6 +80,17 @@ struct POSFloatingControlView: View {
8680
)
8781
}
8882
}
83+
84+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleHistoricalOrdersi1) {
85+
Button {
86+
// TODO: WOOMOB-1133
87+
} label: {
88+
Label(
89+
title: { Text(Localization.orders) },
90+
icon: { Image(systemName: "text.document") }
91+
)
92+
}
93+
}
8994
} label: {
9095
VStack {
9196
Spacer()
@@ -112,11 +117,7 @@ struct POSFloatingControlView: View {
112117
SimpleProductsOnlyInformation(isPresented: $showProductRestrictionsModal)
113118
}
114119
.posModal(isPresented: $showBarcodeScanningModal) {
115-
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleBarcodeScanningi2) {
116-
PointOfSaleBarcodeScannerSetup(isPresented: $showBarcodeScanningModal)
117-
} else {
118-
PointOfSaleBarcodeScannerInformationModal(isPresented: $showBarcodeScanningModal)
119-
}
120+
PointOfSaleBarcodeScannerSetup(isPresented: $showBarcodeScanningModal)
120121
}
121122
.frame(height: Constants.size)
122123
.background(Color.clear)
@@ -161,6 +162,12 @@ private extension POSFloatingControlView {
161162
}
162163

163164
enum Localization {
165+
static let orders = NSLocalizedString(
166+
"pointOfSale.floatingButtons.orders.button.title",
167+
value: "Orders",
168+
comment: "The title of the menu button to access Point of Sale historical orders, shown in a fullscreen view."
169+
)
170+
164171
static let exitPointOfSale = NSLocalizedString(
165172
"pointOfSale.floatingButtons.exit.button.title",
166173
value: "Exit POS",
@@ -187,12 +194,6 @@ private extension POSFloatingControlView {
187194
"We only show simple and variable products in POS, this shows a modal to help explain that limitation."
188195
)
189196

190-
static let barcodeScanning = NSLocalizedString(
191-
"pointOfSale.floatingButtons.barcodeScanning.button.title",
192-
value: "Barcode scanning",
193-
comment: "The title of the menu button to view barcode scanner documentation, shown in a popover menu."
194-
)
195-
196197
static let barcodeScanningSetup = NSLocalizedString(
197198
"pointOfSale.floatingButtons.barcodeScanningSetup.button.title",
198199
value: "Initial barcode scanner setup",

0 commit comments

Comments
 (0)