forked from jsnbuchanan/crowd-funder-for-time-pwa
refactor(qr): improve QR code scanning robustness and error handling
- Enhance JWT extraction with unified path handling and validation - Add debouncing to prevent duplicate scans - Improve error handling and logging throughout QR flow - Add proper TypeScript interfaces for QR scan results - Implement mobile app lifecycle handlers (pause/resume) - Enhance logging with structured data and consistent levels - Clean up scanner resources properly on component destroy - Split contact handling into separate method for better organization - Add proper type for UserNameDialog ref This commit improves the reliability and maintainability of the QR code scanning functionality while adding better error handling and logging.
This commit is contained in:
@@ -86,15 +86,18 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
};
|
||||
|
||||
logger.log("Scanner options:", scanOptions);
|
||||
|
||||
|
||||
// Add listener for barcode scans
|
||||
const handle = await BarcodeScanner.addListener('barcodeScanned', (result) => {
|
||||
if (this.scanListener) {
|
||||
this.scanListener.onScan(result.barcode.rawValue);
|
||||
}
|
||||
});
|
||||
const handle = await BarcodeScanner.addListener(
|
||||
"barcodeScanned",
|
||||
(result) => {
|
||||
if (this.scanListener) {
|
||||
this.scanListener.onScan(result.barcode.rawValue);
|
||||
}
|
||||
},
|
||||
);
|
||||
this.listenerHandles.push(handle.remove);
|
||||
|
||||
|
||||
// Start continuous scanning
|
||||
await BarcodeScanner.startScan(scanOptions);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user