Skip to content

Commit e80294a

Browse files
authored
[Woo POS][Barcodes] Set up flow: last scanner – Netum 1228BC (#15945)
2 parents dd778ab + 03277dc commit e80294a

File tree

10 files changed

+88
-71
lines changed

10 files changed

+88
-71
lines changed

WooCommerce/Classes/POS/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetup.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ struct PointOfSaleBarcodeScannerSetup: View {
6464

6565
private var scannerOptions: [PointOfSaleBarcodeScannerSetupFlowOption] {
6666
[
67-
PointOfSaleBarcodeScannerSetupFlowOption(
68-
title: Localization.socketS720Title,
69-
scannerType: .socketS720
70-
),
7167
PointOfSaleBarcodeScannerSetupFlowOption(
7268
title: Localization.starBSH20BTitle,
7369
scannerType: .starBSH20B
@@ -76,6 +72,10 @@ struct PointOfSaleBarcodeScannerSetup: View {
7672
title: Localization.tera12002DTitle,
7773
scannerType: .tera12002D
7874
),
75+
PointOfSaleBarcodeScannerSetupFlowOption(
76+
title: Localization.netum1228BCTitle,
77+
scannerType: .netum1228BC
78+
),
7979
PointOfSaleBarcodeScannerSetupFlowOption(
8080
title: Localization.otherTitle,
8181
scannerType: .other
@@ -94,11 +94,6 @@ private enum Constants {
9494
@available(iOS 17.0, *)
9595
private extension PointOfSaleBarcodeScannerSetup {
9696
enum Localization {
97-
static let socketS720Title = NSLocalizedString(
98-
"pos.barcodeScannerSetup.socketS720.title",
99-
value: "Socket S720",
100-
comment: "Title for Socket S720 scanner option in barcode scanner setup"
101-
)
10297
static let starBSH20BTitle = NSLocalizedString(
10398
"pos.barcodeScannerSetup.starBSH20B.title",
10499
value: "Star BSH-20B",
@@ -109,6 +104,11 @@ private extension PointOfSaleBarcodeScannerSetup {
109104
value: "Tera 1200 2D",
110105
comment: "Title for Tera 1200 2D scanner option in barcode scanner setup"
111106
)
107+
static let netum1228BCTitle = NSLocalizedString(
108+
"pos.barcodeScannerSetup.netum1228BC.title",
109+
value: "Netum 1228BC",
110+
comment: "Title for Netum 1228BC scanner option in barcode scanner setup"
111+
)
112112
static let otherTitle = NSLocalizedString(
113113
"pos.barcodeScannerSetup.other.title",
114114
value: "Other",

WooCommerce/Classes/POS/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetupFlow.swift

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ class PointOfSaleBarcodeScannerSetupFlow {
104104

105105
private func createFlowSteps(for scannerType: PointOfSaleBarcodeScannerType) -> [PointOfSaleBarcodeScannerStepID: PointOfSaleBarcodeScannerSetupStep] {
106106
switch scannerType {
107-
case .socketS720:
108-
return [
109-
.setupBarcodeHID: createWelcomeStep(title: "Socket S720 Setup")
110-
// TODO: Add more steps for Socket S720 WOOMOB-698
111-
]
112107
case .starBSH20B:
113108
return [
114109
.setupBarcodeHID: PointOfSaleBarcodeScannerSetupStep(
@@ -177,6 +172,46 @@ class PointOfSaleBarcodeScannerSetupFlow {
177172
.complete: setupCompleteStep(),
178173
.setupProducts: setupProductsStep()
179174
]
175+
case .netum1228BC:
176+
return [
177+
.setupBarcodeHID: PointOfSaleBarcodeScannerSetupStep(
178+
content: {
179+
PointOfSaleBarcodeScannerBarcodeView(
180+
title: Localization.scannerSetUpBarcodeStepTitleFormat,
181+
instruction: Localization.setUpBarcodeHIDStepInstruction,
182+
barcode: .netum1228BCHIDBarcode)
183+
},
184+
transitions: [
185+
.next: .setupBarcodePair,
186+
]
187+
),
188+
.setupBarcodePair: PointOfSaleBarcodeScannerSetupStep(
189+
content: {
190+
PointOfSaleBarcodeScannerBarcodeView(
191+
title: Localization.scannerSetUpBarcodeStepTitleFormat,
192+
instruction: Localization.setUpBarcodePairStepInstruction,
193+
barcode: .netum1228BCPairBarcode)
194+
},
195+
transitions: [
196+
.next: .pairing,
197+
.back: .setupBarcodeHID
198+
]
199+
),
200+
.pairing: PointOfSaleBarcodeScannerSetupStep(
201+
content: {
202+
PointOfSaleBarcodeScannerPairingView(scanner: scannerType)
203+
},
204+
transitions: [
205+
.next: .test,
206+
.back: .setupBarcodePair
207+
]
208+
),
209+
.test: testScanStep(barcode: .ean13),
210+
.testScanTimedOut: testScanTimeOutStep(barcode: .ean13),
211+
.testScanFailed: testScanFailedStep(),
212+
.complete: setupCompleteStep(),
213+
.setupProducts: setupProductsStep()
214+
]
180215
case .other:
181216
return [
182217
.setupInformation: PointOfSaleBarcodeScannerSetupStep(
@@ -194,7 +229,7 @@ class PointOfSaleBarcodeScannerSetupFlow {
194229

195230
private func initialStep(for scannerType: PointOfSaleBarcodeScannerType) -> PointOfSaleBarcodeScannerStepID {
196231
switch scannerType {
197-
case .socketS720, .starBSH20B, .tera12002D:
232+
case .starBSH20B, .tera12002D, .netum1228BC:
198233
return .setupBarcodeHID
199234
case .other:
200235
return .setupInformation
@@ -205,14 +240,6 @@ class PointOfSaleBarcodeScannerSetupFlow {
205240
return currentStepKey.analyticsValue
206241
}
207242

208-
private func createWelcomeStep(title: String) -> PointOfSaleBarcodeScannerSetupStep {
209-
PointOfSaleBarcodeScannerSetupStep(
210-
title: title,
211-
content: { PointOfSaleBarcodeScannerWelcomeView(title: title) },
212-
buttonCustomization: PointOfSaleBarcodeScannerWelcomeButtonCustomization()
213-
)
214-
}
215-
216243
// MARK: - Steps
217244

218245
private func testScanStep(

WooCommerce/Classes/POS/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetupModels.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@ struct PointOfSaleBarcodeScannerSetupFlowOption: Identifiable {
88
}
99

1010
enum PointOfSaleBarcodeScannerType {
11-
case socketS720
1211
case starBSH20B
1312
case tera12002D
13+
case netum1228BC
1414
case other
1515

1616
var name: String {
1717
switch self {
18-
case .socketS720:
19-
return Localization.socketS720Name
2018
case .starBSH20B:
2119
return Localization.starBsh20BName
2220
case .tera12002D:
2321
return Localization.tera12002DName
22+
case .netum1228BC:
23+
return Localization.netum1228BCName
2424
case .other:
2525
return Localization.otherName
2626
}
2727
}
2828

2929
var analyticsName: String {
3030
switch self {
31-
case .socketS720:
32-
return "Socket_S720"
3331
case .starBSH20B:
3432
return "Star_BSH_20B"
3533
case .tera12002D:
3634
return "Tera_1200_2D"
35+
case .netum1228BC:
36+
return "Netum_1228BC"
3737
case .other:
3838
return "other"
3939
}
@@ -43,9 +43,9 @@ enum PointOfSaleBarcodeScannerType {
4343
private extension PointOfSaleBarcodeScannerType {
4444
//TODO: WOOMOB-792
4545
enum Localization {
46-
static let socketS720Name = "Socket S720"
4746
static let starBsh20BName = "Star BSH-20B"
4847
static let tera12002DName = "Tera 1200 2D"
48+
static let netum1228BCName = "Netum 1228BC"
4949
static let otherName = "Other scanner"
5050
}
5151
}

WooCommerce/Classes/POS/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetupStepViews.swift

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
import SwiftUI
22

3-
// TODO: Remove this view when all flows are complete
4-
struct PointOfSaleBarcodeScannerWelcomeView: View {
5-
let title: String
6-
7-
var body: some View {
8-
VStack(spacing: POSSpacing.medium) {
9-
Text(title)
10-
.font(.posBodyLargeBold)
11-
.foregroundColor(.posOnSurface)
12-
13-
Text("TODO: Implement \(title) setup flow")
14-
.font(.posBodyMediumRegular())
15-
.foregroundColor(.posOnSurfaceVariantHighest)
16-
.multilineTextAlignment(.center)
17-
}
18-
}
19-
}
20-
213
struct PointOfSaleBarcodeScannerBarcodeView: View {
224
let title: String
235
let instruction: String
@@ -212,25 +194,3 @@ struct PointOfSaleBarcodeScannerErrorView: View {
212194
"to factory settings, then retry the set up flow."
213195
}
214196
}
215-
216-
// MARK: - Button Customizations
217-
@available(iOS 17.0, *)
218-
struct PointOfSaleBarcodeScannerWelcomeButtonCustomization: PointOfSaleBarcodeScannerButtonCustomization {
219-
func customizeButtons(for flow: PointOfSaleBarcodeScannerSetupFlow) -> PointOfSaleFlowButtonConfiguration {
220-
return PointOfSaleFlowButtonConfiguration(
221-
primaryButton: PointOfSaleFlowButtonConfiguration.ButtonConfig(
222-
title: Localization.doneButtonTitle,
223-
action: { flow.nextStep() }
224-
),
225-
secondaryButton: nil
226-
)
227-
}
228-
229-
private enum Localization {
230-
static let doneButtonTitle = NSLocalizedString(
231-
"pos.barcodeScannerSetup.done.button.title",
232-
value: "Done",
233-
comment: "Title for the done button in barcode scanner setup navigation"
234-
)
235-
}
236-
}

WooCommerce/Classes/POS/Presentation/PointOfSaleAssets.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ enum PointOfSaleAssets: CaseIterable {
2020
case starBsh20SetupBarcode
2121
case tera12002DHIDBarcode
2222
case tera12002DPairBarcode
23+
case netum1228BCHIDBarcode
24+
case netum1228BCPairBarcode
2325
case testEan13Barcode
2426

2527
var imageName: String {
@@ -62,6 +64,10 @@ enum PointOfSaleAssets: CaseIterable {
6264
"tera-1200-2d-hid-barcode"
6365
case .tera12002DPairBarcode:
6466
"tera-1200-2d-pair-barcode"
67+
case .netum1228BCHIDBarcode:
68+
"netum-1228bc-hid-barcode"
69+
case .netum1228BCPairBarcode:
70+
"netum-1228bc-pair-barcode"
6571
}
6672
}
6773
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "netum-1228bc-hid-barcode.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "netum-1228bc-pair-barcode.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}

WooCommerce/WooCommerceTests/POS/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetupFlowManagerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct PointOfSaleBarcodeScannerSetupFlowManagerTests {
7575
)
7676

7777
// Setup a scanner flow
78-
sut.selectScanner(.socketS720)
78+
sut.selectScanner(.netum1228BC)
7979
mockAnalytics.events.removeAll() // Clear the selection event
8080

8181
// When keyboard connected notification is posted
@@ -84,7 +84,7 @@ struct PointOfSaleBarcodeScannerSetupFlowManagerTests {
8484
// Then it tracks the scanner connected event
8585
let event = mockAnalytics.events.first
8686
#expect(event?.eventName == WooAnalyticsStat.pointOfSaleBarcodeScannerSetupScannerConnected.rawValue)
87-
#expect(event?.properties["scanner"] as? String == "Socket_S720")
87+
#expect(event?.properties["scanner"] as? String == "Netum_1228BC")
8888
}
8989

9090
@available(iOS 17.0, *)

0 commit comments

Comments
 (0)