Skip to content

Commit 216c380

Browse files
authored
[Woo POS][Barcodes] Set up flow: low end – Scanner Tera 1200 2D (#15913)
2 parents 2e322ea + c9541cd commit 216c380

File tree

19 files changed

+135
-46
lines changed

19 files changed

+135
-46
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ struct PointOfSaleBarcodeScannerSetup: View {
6666
scannerType: .starBSH20B
6767
),
6868
PointOfSaleBarcodeScannerSetupFlowOption(
69-
title: Localization.tbcScannerTitle,
70-
scannerType: .tbcScanner
69+
title: Localization.tera12002DTitle,
70+
scannerType: .tera12002D
7171
),
7272
PointOfSaleBarcodeScannerSetupFlowOption(
7373
title: Localization.otherTitle,
@@ -96,10 +96,10 @@ private extension PointOfSaleBarcodeScannerSetup {
9696
value: "Star BSH-20B",
9797
comment: "Title for Star BSH-20B scanner option in barcode scanner setup"
9898
)
99-
static let tbcScannerTitle = NSLocalizedString(
100-
"pos.barcodeScannerSetup.tbcScanner.title",
101-
value: "Scanner TBC",
102-
comment: "Title for TBC scanner option in barcode scanner setup"
99+
static let tera12002DTitle = NSLocalizedString(
100+
"pos.barcodeScannerSetup.tera12002D.title",
101+
value: "Tera 1200 2D",
102+
comment: "Title for Tera 1200 2D scanner option in barcode scanner setup"
103103
)
104104
static let otherTitle = NSLocalizedString(
105105
"pos.barcodeScannerSetup.other.title",

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

Lines changed: 82 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class PointOfSaleBarcodeScannerSetupFlow {
111111
.setupBarcodeHID: PointOfSaleBarcodeScannerSetupStep(
112112
content: {
113113
PointOfSaleBarcodeScannerBarcodeView(
114-
title: String(format: Localization.starSetUpBarcodeStepTitleFormat, scannerType.name),
115-
instruction: Localization.setUpBarcodeStepInstruction,
114+
title: String(format: Localization.scannerSetUpBarcodeStepTitleFormat, scannerType.name),
115+
instruction: Localization.setUpBarcodeHIDStepInstruction,
116116
barcode: .starBsh20SetupBarcode)
117117
},
118118
transitions: [
@@ -128,35 +128,51 @@ class PointOfSaleBarcodeScannerSetupFlow {
128128
.back: .setupBarcodeHID
129129
]
130130
),
131-
.test: testBarcodeStep(barcode: .ean13, timerCompleted: false),
132-
.testScanTimedOut: testBarcodeStep(barcode: .ean13, timerCompleted: true),
133-
.complete: PointOfSaleBarcodeScannerSetupStep(
131+
.test: testScanStep(barcode: .ean13),
132+
.testScanTimedOut: testScanTimeOutStep(barcode: .ean13),
133+
.testScanFailed: testScanFailedStep(),
134+
.complete: setupCompleteStep(),
135+
.setupInformation: setupInformationStep()
136+
]
137+
case .tera12002D:
138+
return [
139+
.setupBarcodeHID: PointOfSaleBarcodeScannerSetupStep(
134140
content: {
135-
PointOfSaleBarcodeScannerSetupCompleteView()
141+
PointOfSaleBarcodeScannerBarcodeView(
142+
title: Localization.scannerSetUpBarcodeStepTitleFormat,
143+
instruction: Localization.setUpBarcodeHIDStepInstruction,
144+
barcode: .tera12002DHIDBarcode)
136145
},
137-
buttonCustomization: PointOfSaleBarcodeScannerOptionalScannerInformationButtonCustomization(),
138146
transitions: [
139-
.next: .setupInformation,
140-
]),
141-
.testScanFailed: PointOfSaleBarcodeScannerSetupStep(
147+
.next: .setupBarcodePair,
148+
]
149+
),
150+
.setupBarcodePair: PointOfSaleBarcodeScannerSetupStep(
142151
content: {
143-
PointOfSaleBarcodeScannerErrorView()
152+
PointOfSaleBarcodeScannerBarcodeView(
153+
title: Localization.scannerSetUpBarcodeStepTitleFormat,
154+
instruction: Localization.setUpBarcodePairStepInstruction,
155+
barcode: .tera12002DPairBarcode)
144156
},
145-
buttonCustomization: PointOfSaleBarcodeScannerErrorButtonCustomization(),
146157
transitions: [
147-
.retry: .setupBarcodeHID,
148-
.back: .test
158+
.next: .pairing,
159+
.back: .setupBarcodeHID
149160
]
150161
),
151-
.setupInformation: PointOfSaleBarcodeScannerSetupStep(
152-
content: { ProductBarcodeSetupInformation() },
153-
buttonCustomization: PointOfSaleBarcodeScannerNoButtonsButtonCustomization()
154-
)
155-
]
156-
case .tbcScanner:
157-
return [
158-
.setupBarcodeHID: createWelcomeStep(title: "TBC Scanner Setup")
159-
// TODO: Add more steps for TBC Scanner WOOMOB-699
162+
.pairing: PointOfSaleBarcodeScannerSetupStep(
163+
content: {
164+
PointOfSaleBarcodeScannerPairingView(scanner: scannerType)
165+
},
166+
transitions: [
167+
.next: .test,
168+
.back: .setupBarcodePair
169+
]
170+
),
171+
.test: testScanStep(barcode: .ean13),
172+
.testScanTimedOut: testScanTimeOutStep(barcode: .ean13),
173+
.testScanFailed: testScanFailedStep(),
174+
.complete: setupCompleteStep(),
175+
.setupInformation: setupInformationStep()
160176
]
161177
case .other:
162178
return [
@@ -175,7 +191,7 @@ class PointOfSaleBarcodeScannerSetupFlow {
175191

176192
private func initialStep(for scannerType: PointOfSaleBarcodeScannerType) -> PointOfSaleBarcodeScannerStepID {
177193
switch scannerType {
178-
case .socketS720, .starBSH20B, .tbcScanner:
194+
case .socketS720, .starBSH20B, .tera12002D:
179195
return .setupBarcodeHID
180196
case .other:
181197
return .setupInformation
@@ -194,7 +210,9 @@ class PointOfSaleBarcodeScannerSetupFlow {
194210
)
195211
}
196212

197-
private func testBarcodeStep(barcode: PointOfSaleBarcodeScannerTestBarcode, timerCompleted: Bool) -> PointOfSaleBarcodeScannerSetupStep {
213+
// MARK: - Steps
214+
215+
private func testScanStep(barcode: PointOfSaleBarcodeScannerTestBarcode, timerCompleted: Bool = false) -> PointOfSaleBarcodeScannerSetupStep {
198216
PointOfSaleBarcodeScannerSetupStep(
199217
content: {
200218
PointOfSaleBarcodeScannerTestBarcodeView(
@@ -221,6 +239,41 @@ class PointOfSaleBarcodeScannerSetupFlow {
221239
]
222240
)
223241
}
242+
243+
private func testScanTimeOutStep(barcode: PointOfSaleBarcodeScannerTestBarcode) -> PointOfSaleBarcodeScannerSetupStep {
244+
testScanStep(barcode: barcode, timerCompleted: true)
245+
}
246+
247+
private func testScanFailedStep() -> PointOfSaleBarcodeScannerSetupStep {
248+
PointOfSaleBarcodeScannerSetupStep(
249+
content: {
250+
PointOfSaleBarcodeScannerErrorView()
251+
},
252+
buttonCustomization: PointOfSaleBarcodeScannerErrorButtonCustomization(),
253+
transitions: [
254+
.retry: .setupBarcodeHID,
255+
.back: .test
256+
]
257+
)
258+
}
259+
260+
private func setupCompleteStep() -> PointOfSaleBarcodeScannerSetupStep {
261+
PointOfSaleBarcodeScannerSetupStep(
262+
content: {
263+
PointOfSaleBarcodeScannerSetupCompleteView()
264+
},
265+
buttonCustomization: PointOfSaleBarcodeScannerOptionalScannerInformationButtonCustomization(),
266+
transitions: [
267+
.next: .setupInformation,
268+
])
269+
}
270+
271+
private func setupInformationStep() -> PointOfSaleBarcodeScannerSetupStep {
272+
PointOfSaleBarcodeScannerSetupStep(
273+
content: { ProductBarcodeSetupInformation() },
274+
buttonCustomization: PointOfSaleBarcodeScannerNoButtonsButtonCustomization()
275+
)
276+
}
224277
}
225278

226279
@available(iOS 17.0, *)
@@ -326,9 +379,7 @@ private extension PointOfSaleBarcodeScannerSetupFlow {
326379
}
327380

328381
private func trackRetry() {
329-
if let step = getCurrentAnalyticsStepValue() {
330-
analytics.track(event: WooAnalyticsEvent.PointOfSale.barcodeScannerSetupRetryTapped(scanner: scannerType))
331-
}
382+
analytics.track(event: WooAnalyticsEvent.PointOfSale.barcodeScannerSetupRetryTapped(scanner: scannerType))
332383
}
333384
}
334385

@@ -347,7 +398,8 @@ private extension PointOfSaleBarcodeScannerSetupFlow {
347398
comment: "Title for the back button in barcode scanner setup navigation"
348399
)
349400
//TODO: WOOMOB-792
350-
static let starSetUpBarcodeStepTitleFormat = "%1$@ Setup"
351-
static let setUpBarcodeStepInstruction = "Scan the barcode to set up your scanner."
401+
static let scannerSetUpBarcodeStepTitleFormat = "Scanner Setup"
402+
static let setUpBarcodeHIDStepInstruction = "Scan the Bluetooth HID symbol."
403+
static let setUpBarcodePairStepInstruction = "Scan the Pair symbol to get the scanner ready for pairing."
352404
}
353405
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct PointOfSaleBarcodeScannerSetupFlowOption: Identifiable {
1010
enum PointOfSaleBarcodeScannerType {
1111
case socketS720
1212
case starBSH20B
13-
case tbcScanner
13+
case tera12002D
1414
case other
1515

1616
var name: String {
@@ -19,8 +19,8 @@ enum PointOfSaleBarcodeScannerType {
1919
return Localization.socketS720Name
2020
case .starBSH20B:
2121
return Localization.starBsh20BName
22-
case .tbcScanner:
23-
return Localization.tbcScannerName
22+
case .tera12002D:
23+
return Localization.tera12002DName
2424
case .other:
2525
return Localization.otherName
2626
}
@@ -32,8 +32,8 @@ enum PointOfSaleBarcodeScannerType {
3232
return "Socket_S720"
3333
case .starBSH20B:
3434
return "Star_BSH_20B"
35-
case .tbcScanner:
36-
return "TBC"
35+
case .tera12002D:
36+
return "Tera_1200_2D"
3737
case .other:
3838
return "other"
3939
}
@@ -45,7 +45,7 @@ private extension PointOfSaleBarcodeScannerType {
4545
enum Localization {
4646
static let socketS720Name = "Socket S720"
4747
static let starBsh20BName = "Star BSH-20B"
48-
static let tbcScannerName = "TBC scanner"
48+
static let tera12002DName = "Tera 1200 2D"
4949
static let otherName = "Other scanner"
5050
}
5151
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ struct PointOfSaleBarcodeScannerBarcodeView: View {
4141
.resizable()
4242
.aspectRatio(contentMode: .fit)
4343
.frame(maxHeight: Constants.maxBarcodeSize)
44+
.background(Color.white)
4445
}
4546
}
4647
}
4748

4849
extension PointOfSaleBarcodeScannerBarcodeView {
4950
enum Constants {
50-
static let maxBarcodeSize: CGFloat = 168
51+
static let maxBarcodeSize: CGFloat = 142
5152
}
5253
}
5354

WooCommerce/Classes/POS/Presentation/PointOfSaleAssets.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ enum PointOfSaleAssets: CaseIterable {
1818
case barcodeFieldScreenshot
1919
//TODO: WOOMOB-793 Update the imagesets for these barcodes to vector/dark mode friendly images
2020
case starBsh20SetupBarcode
21+
case tera12002DHIDBarcode
22+
case tera12002DPairBarcode
2123
case testEan13Barcode
2224

2325
var imageName: String {
@@ -56,6 +58,10 @@ enum PointOfSaleAssets: CaseIterable {
5658
"star-bsh20-setup-barcode"
5759
case .testEan13Barcode:
5860
"test-ean13-barcode"
61+
case .tera12002DHIDBarcode:
62+
"tera-1200-2d-hid-barcode"
63+
case .tera12002DPairBarcode:
64+
"tera-1200-2d-pair-barcode"
5965
}
6066
}
6167
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

0 commit comments

Comments
 (0)