Skip to content

Commit b900359

Browse files
committed
Add Star set up code view in set up flow
1 parent ff587e1 commit b900359

File tree

6 files changed

+74
-2
lines changed

6 files changed

+74
-2
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ class PointOfSaleBarcodeScannerSetupFlow {
8585
]
8686
case .starBSH20B:
8787
return [
88-
createWelcomeStep(title: "Star BSH-20B Setup")
88+
PointOfSaleBarcodeScannerSetupStep(content: {
89+
PointOfSaleBarcodeScannerBarcodeView(
90+
title: String(format: Localization.starSetUpBarcodeStepTitleFormat, scannerType.name),
91+
instruction: Localization.setUpBarcodeStepInstruction,
92+
barcode: .starBsh20SetupBarcode)
93+
})
8994
// TODO: Add more steps for Star BSH-20B WOOMOB-696
9095
]
9196
case .tbcScanner:
@@ -131,5 +136,8 @@ private extension PointOfSaleBarcodeScannerSetupFlow {
131136
value: "Back",
132137
comment: "Title for the back button in barcode scanner setup navigation"
133138
)
139+
//TODO: WOOMOB-792
140+
static let starSetUpBarcodeStepTitleFormat = "%1$@ Setup"
141+
static let setUpBarcodeStepInstruction = "Scan the barcode to set up your scanner."
134142
}
135143
}

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,29 @@ enum PointOfSaleBarcodeScannerType {
1313
case starBSH20B
1414
case tbcScanner
1515
case other
16+
17+
var name: String {
18+
switch self {
19+
case .socketS720:
20+
return Localization.socketS720Name
21+
case .starBSH20B:
22+
return Localization.starBsh20BName
23+
case .tbcScanner:
24+
return Localization.tbcScannerName
25+
case .other:
26+
return Localization.otherName
27+
}
28+
}
29+
}
30+
31+
private extension PointOfSaleBarcodeScannerType {
32+
//TODO: WOOMOB-792
33+
enum Localization {
34+
static let socketS720Name = "Socket S720"
35+
static let starBsh20BName = "Star BSH-20B"
36+
static let tbcScannerName = "TBC scanner"
37+
static let otherName = "Other scanner"
38+
}
1639
}
1740

1841
// MARK: - Flow State
@@ -35,7 +58,7 @@ struct PointOfSaleBarcodeScannerSetupStep {
3558
let buttonCustomization: PointOfSaleBarcodeScannerButtonCustomization?
3659

3760
init(
38-
title: String,
61+
title: String = "",
3962
@ViewBuilder content: () -> any View,
4063
buttonCustomization: PointOfSaleBarcodeScannerButtonCustomization? = nil
4164
) {

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,32 @@ struct PointOfSaleBarcodeScannerWelcomeView: View {
1919
}
2020
}
2121

22+
struct PointOfSaleBarcodeScannerBarcodeView: View {
23+
let title: String
24+
let instruction: String
25+
let barcode: PointOfSaleAssets
26+
27+
var body: some View {
28+
VStack(spacing: POSSpacing.xLarge) {
29+
VStack(alignment: .center, spacing: POSSpacing.small) {
30+
Text(title)
31+
.font(.posHeadingBold)
32+
.foregroundColor(.posOnSurface)
33+
.accessibilityAddTraits(.isHeader)
34+
35+
Text(instruction)
36+
.font(.posBodyMediumRegular())
37+
.foregroundColor(.posOnSurfaceVariantHighest)
38+
.multilineTextAlignment(.center)
39+
}
40+
41+
Image(barcode.imageName)
42+
}
43+
.frame(maxWidth: .infinity, maxHeight: .infinity)
44+
}
45+
}
46+
47+
2248
// MARK: - Button Customizations
2349
@available(iOS 17.0, *)
2450
struct PointOfSaleBarcodeScannerWelcomeButtonCustomization: PointOfSaleBarcodeScannerButtonCustomization {

WooCommerce/Classes/POS/Presentation/PointOfSaleAssets.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enum PointOfSaleAssets: CaseIterable {
1414
case shoppingBags
1515
case successCheck
1616
case coupons
17+
case starBsh20SetupBarcode
1718

1819
var imageName: String {
1920
switch self {
@@ -43,6 +44,8 @@ enum PointOfSaleAssets: CaseIterable {
4344
"pos-success-check"
4445
case .coupons:
4546
"coupons"
47+
case .starBsh20SetupBarcode:
48+
"star-bsh20-setup-barcode"
4649
}
4750
}
4851
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "star-bsh20-setup-barcode.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}

0 commit comments

Comments
 (0)