Skip to content

Commit c9c8b48

Browse files
authored
[Woo POS][Barcodes] Copy, Localization, and UI adjustments (#15948)
2 parents 8f77c38 + 0e51750 commit c9c8b48

8 files changed

+193
-45
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct PointOfSaleBarcodeScannerSetup: View {
1717
maxHeight: parentSize.height * Constants.maxParentHeightRatio,
1818
id: flowManager.currentStepKey
1919
) {
20-
VStack(spacing: POSSpacing.xxLarge) {
20+
VStack(spacing: POSSpacing.xLarge) {
2121
ScrollView(showsIndicators: false) {
2222
HStack {
2323
Spacer()
@@ -35,7 +35,7 @@ struct PointOfSaleBarcodeScannerSetup: View {
3535
.posModalCloseButton(action: {
3636
isPresented = false
3737
})
38-
.padding(POSPadding.xxLarge)
38+
.padding(POSPadding.xLarge)
3939
.background(Color.posSurfaceBright)
4040
}
4141
.onAppear {
@@ -117,6 +117,8 @@ private extension PointOfSaleBarcodeScannerSetup {
117117
}
118118
}
119119

120+
// MARK: - Previews
121+
120122
@available(iOS 17.0, *)
121123
#Preview {
122124
PointOfSaleBarcodeScannerSetup(isPresented: .constant(true))

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,11 @@ struct PointOfSaleBarcodeScannerOptionalScannerInformationButtonCustomization: P
377377
}
378378

379379
private enum Localization {
380-
static let informationButtonTitle = "How to set up barcodes on products"
380+
static let informationButtonTitle = NSLocalizedString(
381+
"pos.barcodeScannerSetup.productBarcodeInformation.button.title",
382+
value: "How to set up barcodes on products",
383+
comment: "Button title for accessing product barcode setup information"
384+
)
381385
}
382386
}
383387

@@ -451,9 +455,20 @@ private extension PointOfSaleBarcodeScannerSetupFlow {
451455
comment: "Title for the done button in barcode scanner setup navigation"
452456
)
453457

454-
//TODO: WOOMOB-792
455-
static let scannerSetUpBarcodeStepTitleFormat = "Scanner Setup"
456-
static let setUpBarcodeHIDStepInstruction = "Scan the Bluetooth HID symbol."
457-
static let setUpBarcodePairStepInstruction = "Scan the Pair symbol to get the scanner ready for pairing."
458+
static let scannerSetUpBarcodeStepTitleFormat = NSLocalizedString(
459+
"pos.barcodeScannerSetup.scanner.setup.title.format",
460+
value: "Scanner setup",
461+
comment: "Title format for barcode scanner setup step"
462+
)
463+
static let setUpBarcodeHIDStepInstruction = NSLocalizedString(
464+
"pos.barcodeScannerSetup.hidSetup.instruction",
465+
value: "Use your barcode scanner to scan the code below to enable Bluetooth HID mode.",
466+
comment: "Instruction for scanning the Bluetooth HID barcode during scanner setup"
467+
)
468+
static let setUpBarcodePairStepInstruction = NSLocalizedString(
469+
"pos.barcodeScannerSetup.pairSetup.instruction",
470+
value: "Use your barcode scanner to scan the code below to enter pairing mode.",
471+
comment: "Instruction for scanning the Pair barcode to prepare scanner for pairing"
472+
)
458473
}
459474
}

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,27 @@ enum PointOfSaleBarcodeScannerType {
4141
}
4242

4343
private extension PointOfSaleBarcodeScannerType {
44-
//TODO: WOOMOB-792
4544
enum Localization {
46-
static let starBsh20BName = "Star BSH-20B"
47-
static let tera12002DName = "Tera 1200 2D"
48-
static let netum1228BCName = "Netum 1228BC"
49-
static let otherName = "Other scanner"
45+
static let starBsh20BName = NSLocalizedString(
46+
"pos.barcodeScannerSetup.scannerType.starBSH20B.name",
47+
value: "Star BSH-20B",
48+
comment: "Display name for Star BSH-20B barcode scanner model"
49+
)
50+
static let tera12002DName = NSLocalizedString(
51+
"pos.barcodeScannerSetup.scannerType.tera12002D.name",
52+
value: "Tera 1200 2D",
53+
comment: "Display name for Tera 1200 2D barcode scanner model"
54+
)
55+
static let netum1228BCName = NSLocalizedString(
56+
"pos.barcodeScannerSetup.scannerType.netum1228BC.name",
57+
value: "Netum 1228BC",
58+
comment: "Display name for Netum 1228BC barcode scanner model"
59+
)
60+
static let otherName = NSLocalizedString(
61+
"pos.barcodeScannerSetup.scannerType.other.name",
62+
value: "Other scanner",
63+
comment: "Display name for other/unspecified barcode scanner models"
64+
)
5065
}
5166
}
5267

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

Lines changed: 126 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct PointOfSaleBarcodeScannerBarcodeView: View {
1515

1616
Text(instruction)
1717
.font(.posBodyLargeRegular())
18-
.foregroundColor(.posOnSurfaceVariantHighest)
18+
.foregroundColor(.posOnSurface)
1919
.multilineTextAlignment(.center)
2020
}
2121

@@ -41,7 +41,6 @@ struct PointOfSaleBarcodeScannerPairingView: View {
4141

4242
var body: some View {
4343
VStack(spacing: POSSpacing.xLarge) {
44-
// Temporary image until finalised assets are available
4544
Image(decorative: PointOfSaleAssets.gears.imageName)
4645
.resizable()
4746
.frame(width: Constants.gearIconSize, height: Constants.gearIconSize)
@@ -54,7 +53,7 @@ struct PointOfSaleBarcodeScannerPairingView: View {
5453

5554
Text(instruction)
5655
.font(.posBodyLargeRegular())
57-
.foregroundColor(.posOnSurfaceVariantHighest)
56+
.foregroundColor(.posOnSurface)
5857
.multilineTextAlignment(.center)
5958
}
6059

@@ -67,8 +66,11 @@ struct PointOfSaleBarcodeScannerPairingView: View {
6766
UIApplication.shared.open(targetURL)
6867
} label: {
6968
Text(Localization.settingsButtonTitle)
69+
.font(.posBodyLargeRegular())
70+
.foregroundColor(.posPrimaryContainer)
71+
.underline()
7072
}
71-
.buttonStyle(POSOutlinedButtonStyle(size: .extraSmall))
73+
.padding(.top, POSSpacing.large)
7274
}
7375
}
7476

@@ -78,11 +80,22 @@ struct PointOfSaleBarcodeScannerPairingView: View {
7880
}
7981

8082
private extension PointOfSaleBarcodeScannerPairingView {
81-
//TODO: WOOMOB-792
8283
enum Localization {
83-
static let settingsButtonTitle = "Go to settings"
84-
static let title = "Pair your scanner"
85-
static let instructionFormat = "Enable Bluetooth and select your %1$@ scanner in iOS Settings."
84+
static let settingsButtonTitle = NSLocalizedString(
85+
"pos.barcodeScannerSetup.pairing.settingsButton.title",
86+
value: "Go to your device settings",
87+
comment: "Button title to open device Settings for scanner pairing"
88+
)
89+
static let title = NSLocalizedString(
90+
"pos.barcodeScannerSetup.pairing.title",
91+
value: "Pair your scanner",
92+
comment: "Title for the scanner pairing step"
93+
)
94+
static let instructionFormat = NSLocalizedString(
95+
"pos.barcodeScannerSetup.pairing.instruction.format",
96+
value: "Enable Bluetooth and select your %1$@ scanner in the iOS Bluetooth settings. The scanner will beep and show a solid LED when paired.",
97+
comment: "Instruction for pairing scanner via device settings with feedback indicators. %1$@ is the scanner model name."
98+
)
8699
}
87100

88101
enum Constants {
@@ -117,10 +130,26 @@ struct PointOfSaleBarcodeScannerTestBarcodeView: View {
117130
@available(iOS 17.0, *)
118131
private extension PointOfSaleBarcodeScannerTestBarcodeView {
119132
enum Localization {
120-
static let title = "Test your scanner"
121-
static let instruction = "Scan the barcode to test your scanner"
122-
static let timeoutTitle = "No scan data found yet"
123-
static let timeoutInstruction = "Scan the barcode to test your scanner. If the issue continues, please check Bluetooth settings and try again."
133+
static let title = NSLocalizedString(
134+
"pos.barcodeScannerSetup.test.title",
135+
value: "Test your scanner",
136+
comment: "Title for the scanner testing step"
137+
)
138+
static let instruction = NSLocalizedString(
139+
"pos.barcodeScannerSetup.test.instruction",
140+
value: "Scan the barcode to test your scanner.",
141+
comment: "Instruction for testing the scanner by scanning a barcode"
142+
)
143+
static let timeoutTitle = NSLocalizedString(
144+
"pos.barcodeScannerSetup.test.timeout.title",
145+
value: "No scan data found yet",
146+
comment: "Title shown when scanner test times out without detecting a scan"
147+
)
148+
static let timeoutInstruction = NSLocalizedString(
149+
"pos.barcodeScannerSetup.test.timeout.instruction",
150+
value: "Scan the barcode to test your scanner. If the issue continues, please check Bluetooth settings and try again.",
151+
comment: "Instruction shown when scanner test times out, suggesting troubleshooting steps"
152+
)
124153
}
125154
}
126155

@@ -139,7 +168,7 @@ struct PointOfSaleBarcodeScannerSetupCompleteView: View {
139168

140169
Text(Localization.instruction)
141170
.font(.posBodyLargeRegular())
142-
.foregroundColor(.posOnSurfaceVariantHighest)
171+
.foregroundColor(.posOnSurface)
143172
.multilineTextAlignment(.center)
144173
}
145174
}
@@ -148,23 +177,29 @@ struct PointOfSaleBarcodeScannerSetupCompleteView: View {
148177
@ViewBuilder private var successIcon: some View {
149178
ZStack {
150179
Circle()
151-
.frame(width: 104, height: 104)
180+
.frame(width: 88, height: 88)
152181
.foregroundColor(.posSuccess)
153182
Image(PointOfSaleAssets.successCheck.imageName)
154183
.renderingMode(.template)
155184
.resizable()
156-
.frame(width: 48, height: 48)
185+
.frame(width: 36, height: 36)
157186
.foregroundColor(.posOnSuccess)
158187
}
159188
}
160189
}
161190

162191
private extension PointOfSaleBarcodeScannerSetupCompleteView {
163192
enum Localization {
164-
//TODO: WOOMOB-792
165-
static let title = "Scanner set up!"
166-
static let instruction = "You are ready to start scanning products. \n" +
167-
"Read more about barcode and QR code scanner support."
193+
static let title = NSLocalizedString(
194+
"pos.barcodeScannerSetup.complete.title",
195+
value: "Scanner set up!",
196+
comment: "Title shown when scanner setup is successfully completed"
197+
)
198+
static let instruction = NSLocalizedString(
199+
"pos.barcodeScannerSetup.complete.instruction",
200+
value: "You are ready to start scanning products. \nRead more about barcode and QR code scanner support.",
201+
comment: "Message shown when scanner setup is complete, with additional information link"
202+
)
168203
}
169204
}
170205

@@ -181,16 +216,84 @@ struct PointOfSaleBarcodeScannerErrorView: View {
181216

182217
Text(Localization.instruction)
183218
.font(.posBodyLargeRegular())
184-
.foregroundColor(.posOnSurfaceVariantHighest)
219+
.foregroundColor(.posOnSurface)
185220
.multilineTextAlignment(.center)
186221
}
187222
}
188223
.padding(POSSpacing.xLarge)
189224
}
190225

191226
private enum Localization {
192-
static let title = "Scanning issue found"
193-
static let instruction = "Please check the scanner’s manual and reset it \n" +
194-
"to factory settings, then retry the set up flow."
227+
static let title = NSLocalizedString(
228+
"pos.barcodeScannerSetup.error.title",
229+
value: "Scanning issue found",
230+
comment: "Title shown when there's an error during scanner setup"
231+
)
232+
static let instruction = NSLocalizedString(
233+
"pos.barcodeScannerSetup.error.instruction",
234+
value: "Please check the scanner's manual and reset it to factory settings, then retry the setup flow.",
235+
comment: "Instruction shown when scanner setup encounters an error, suggesting troubleshooting steps"
236+
)
195237
}
196238
}
239+
240+
// MARK: - Previews
241+
242+
@available(iOS 17.0, *)
243+
#Preview("Barcode View - HID Setup") {
244+
PointOfSaleBarcodeScannerBarcodeView(
245+
title: "Star BSH-20B setup",
246+
instruction: "Use your barcode scanner to scan the code below to enable Bluetooth HID mode.",
247+
barcode: .starBsh20SetupBarcode
248+
)
249+
}
250+
251+
@available(iOS 17.0, *)
252+
#Preview("Barcode View - Barcode Setup") {
253+
PointOfSaleBarcodeScannerBarcodeView(
254+
title: "Scanner setup",
255+
instruction: "Use your barcode scanner to scan the code below to enable Bluetooth HID mode.",
256+
barcode: .netum1228BCHIDBarcode
257+
)
258+
}
259+
260+
@available(iOS 17.0, *)
261+
#Preview("Pairing View - Netum 1228BC") {
262+
PointOfSaleBarcodeScannerPairingView(scanner: .netum1228BC)
263+
}
264+
265+
@available(iOS 17.0, *)
266+
#Preview("Test View - Normal") {
267+
PointOfSaleBarcodeScannerTestBarcodeView(
268+
scanTester: PointOfSaleBarcodeScannerSetupScanTester(
269+
onTestPass: {},
270+
onTestFailure: { _ in },
271+
onTestTimeout: {},
272+
barcodeDefinition: .ean13
273+
),
274+
timerCompleted: false
275+
)
276+
}
277+
278+
@available(iOS 17.0, *)
279+
#Preview("Test View - Timeout") {
280+
PointOfSaleBarcodeScannerTestBarcodeView(
281+
scanTester: PointOfSaleBarcodeScannerSetupScanTester(
282+
onTestPass: {},
283+
onTestFailure: { _ in },
284+
onTestTimeout: {},
285+
barcodeDefinition: .ean13
286+
),
287+
timerCompleted: true
288+
)
289+
}
290+
291+
@available(iOS 17.0, *)
292+
#Preview("Setup Complete View") {
293+
PointOfSaleBarcodeScannerSetupCompleteView()
294+
}
295+
296+
@available(iOS 17.0, *)
297+
#Preview("Error View") {
298+
PointOfSaleBarcodeScannerErrorView()
299+
}

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ struct PointOfSaleBarcodeScannerSetupSelectionView: View {
3535
// MARK: - Private Localization Extensions
3636
private extension PointOfSaleBarcodeScannerSetupSelectionView {
3737
enum Localization {
38-
//TODO: WOOMOB-792
39-
// Note that "pos.barcodeScannerSetup.introMessage" was previously sent for translation, so don't reuse that.
40-
static let setupIntroMessage = "Select a model from the list:"
38+
static let setupIntroMessage = NSLocalizedString(
39+
"pos.barcodeScannerSetup.selection.introMessage",
40+
value: "Select a model from the list:",
41+
comment: "Instruction message for selecting a barcode scanner model from the list"
42+
)
4143

42-
// Note that "pos.barcodeScannerSetup.heading" was previously sent to translation – don't reuse
43-
static let setupHeading = "Set up a barcode scanner"
44+
static let setupHeading = NSLocalizedString(
45+
"pos.barcodeScannerSetup.selection.heading",
46+
value: "Set up a barcode scanner",
47+
comment: "Heading for the barcode scanner setup selection screen"
48+
)
4449
}
4550
}

WooCommerce/Classes/POS/Presentation/PointOfSaleAssets.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ enum PointOfSaleAssets: CaseIterable {
1616
case coupons
1717
case gears
1818
case barcodeFieldScreenshot
19-
//TODO: WOOMOB-793 Update the imagesets for these barcodes to vector/dark mode friendly images
2019
case starBsh20SetupBarcode
2120
case tera12002DHIDBarcode
2221
case tera12002DPairBarcode

WooCommerce/Classes/POS/Presentation/PointOfSaleBarcodeScannerInformationModal.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,17 @@ private enum Localization {
147147
comment: "Heading for the barcode info modal in POS, introducing barcode scanning feature"
148148
)
149149

150-
static let scannerInfoHeading = "Scanner set up"
151-
static let productBarcodeInfoHeading = "How to set up barcodes on products"
150+
static let scannerInfoHeading = NSLocalizedString(
151+
"pos.barcodeScannerSetup.scannerInfo.title",
152+
value: "Scanner setup",
153+
comment: "Title format for barcode scanner setup step"
154+
)
155+
156+
static let productBarcodeInfoHeading = NSLocalizedString(
157+
"pos.barcodeScannerSetup.productBarcodeInfo.title",
158+
value: "How to set up barcodes on products",
159+
comment: "Title format for a product barcode setup step"
160+
)
152161

153162
static let legacyBarcodeInfoIntroMessage = NSLocalizedString(
154163
"pos.barcodeInfoModal.introMessage",

WooCommerce/Classes/POS/Presentation/Reusable Views/POSModalCloseButton.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ struct POSModalCloseButton: ViewModifier {
2222
Spacer()
2323
Button(action: closeAction, label: {
2424
Text(Image(systemName: "xmark"))
25-
.font(.posButtonSymbolSmall)
25+
.font(.posButtonSymbolMedium)
2626
})
27-
.foregroundColor(Color.posOnSurfaceVariantLowest)
27+
.foregroundColor(Color.posOnSurface)
2828
.accessibilityLabel(accessibilityLabel)
2929
}
3030

0 commit comments

Comments
 (0)