File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
WooCommerce/Classes/POS/Presentation/Barcode Scanner Setup Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -93,14 +93,29 @@ private extension PointOfSaleBarcodeScannerPairingView {
9393@available ( iOS 17 . 0 , * )
9494struct PointOfSaleBarcodeScannerTestBarcodeView : View {
9595 let scanTester : PointOfSaleBarcodeScannerSetupScanTester
96+ @State private var timerCompleted = false
97+ @State private var timer : Timer ?
9698
9799 var body : some View {
98- PointOfSaleBarcodeScannerBarcodeView ( title: Localization . title,
99- instruction: Localization . instruction,
100+ PointOfSaleBarcodeScannerBarcodeView ( title: timerCompleted ? Localization . timeoutTitle : Localization . title,
101+ instruction: timerCompleted ? Localization . timeoutInstruction : Localization . instruction,
100102 barcode: scanTester. barcode)
101103 . barcodeScanning { result in
102104 scanTester. handleScan ( result)
103105 }
106+ . onAppear {
107+ startTimer ( )
108+ }
109+ . onDisappear {
110+ timer? . invalidate ( )
111+ timer = nil
112+ }
113+ }
114+
115+ private func startTimer( ) {
116+ timer = Timer . scheduledTimer ( withTimeInterval: 10.0 , repeats: false ) { _ in
117+ timerCompleted = true
118+ }
104119 }
105120}
106121
@@ -109,6 +124,8 @@ private extension PointOfSaleBarcodeScannerTestBarcodeView {
109124 enum Localization {
110125 static let title = " Test your scanner "
111126 static let instruction = " Scan the barcode to test your scanner "
127+ static let timeoutTitle = " No scan data found yet "
128+ static let timeoutInstruction = " Scan the barcode to test your scanner. If the issue continues, please check Bluetooth settings and try again. "
112129 }
113130}
114131
You can’t perform that action at this time.
0 commit comments