Skip to content

Commit 8553d97

Browse files
committed
Add pairing barcode scanner set up step
1 parent b900359 commit 8553d97

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ class PointOfSaleBarcodeScannerSetupFlow {
9090
title: String(format: Localization.starSetUpBarcodeStepTitleFormat, scannerType.name),
9191
instruction: Localization.setUpBarcodeStepInstruction,
9292
barcode: .starBsh20SetupBarcode)
93-
})
93+
}),
94+
PointOfSaleBarcodeScannerSetupStep(content: {
95+
PointOfSaleBarcodeScannerPairingView(scanner: scannerType)
96+
}),
9497
// TODO: Add more steps for Star BSH-20B WOOMOB-696
9598
]
9699
case .tbcScanner:

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,55 @@ struct PointOfSaleBarcodeScannerBarcodeView: View {
4444
}
4545
}
4646

47+
struct PointOfSaleBarcodeScannerPairingView: View {
48+
let scanner: PointOfSaleBarcodeScannerType
49+
50+
var body: some View {
51+
VStack(spacing: POSSpacing.xLarge) {
52+
// Temporary image until finalised assets are available
53+
Image(systemName: "gearshape")
54+
.font(.system(size: 78))
55+
.accessibilityHidden(true)
56+
57+
VStack(alignment: .center, spacing: POSSpacing.small) {
58+
Text(Localization.title)
59+
.font(.posHeadingBold)
60+
.foregroundColor(.posOnSurface)
61+
.accessibilityAddTraits(.isHeader)
62+
63+
Text(instruction)
64+
.font(.posBodyMediumRegular())
65+
.foregroundColor(.posOnSurfaceVariantHighest)
66+
.multilineTextAlignment(.center)
67+
}
68+
69+
Button {
70+
guard let targetURL = URL(string: UIApplication.openSettingsURLString) else {
71+
return
72+
}
73+
UIApplication.shared.open(targetURL)
74+
} label: {
75+
Text(Localization.settingsButtonTitle)
76+
}
77+
.buttonStyle(POSOutlinedButtonStyle(size: .extraSmall))
78+
}
79+
.frame(maxWidth: .infinity, maxHeight: .infinity)
80+
}
81+
82+
private var instruction: String {
83+
String(format: Localization.instructionFormat, scanner.name)
84+
}
85+
}
86+
87+
private extension PointOfSaleBarcodeScannerPairingView {
88+
//TODO: WOOMOB-792
89+
enum Localization {
90+
static let settingsButtonTitle = "Go to settings"
91+
static let title = "Pair your device"
92+
static let instructionFormat = "Enable Bluetooth and select your %1$@ scanner in iOS Settings."
93+
}
94+
}
95+
4796

4897
// MARK: - Button Customizations
4998
@available(iOS 17.0, *)

0 commit comments

Comments
 (0)