@@ -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
8082private 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 , * )
118131private 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
162191private 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. \n Read 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+ }
0 commit comments