chore: cleanup and test

This commit is contained in:
Matthew Raymer
2025-04-22 07:48:04 +00:00
parent 448f32abaa
commit 3e87b2ecda
9 changed files with 75 additions and 49 deletions

View File

@@ -54,9 +54,9 @@ export class CapacitorQRScanner implements QRScannerService {
try {
// Ensure we have permissions before starting
logger.log('Checking camera permissions...');
logger.log("Checking camera permissions...");
if (!(await this.checkPermissions())) {
logger.log('Requesting camera permissions...');
logger.log("Requesting camera permissions...");
const granted = await this.requestPermissions();
if (!granted) {
throw new Error("Camera permission denied");
@@ -64,12 +64,12 @@ export class CapacitorQRScanner implements QRScannerService {
}
// Check if scanning is supported
logger.log('Checking scanner support...');
logger.log("Checking scanner support...");
if (!(await this.isSupported())) {
throw new Error("QR scanning not supported on this device");
}
logger.log('Starting MLKit scanner...');
logger.log("Starting MLKit scanner...");
this.isScanning = true;
const scanOptions: StartScanOptions = {
@@ -78,9 +78,9 @@ export class CapacitorQRScanner implements QRScannerService {
options?.camera === "front" ? LensFacing.Front : LensFacing.Back,
};
logger.log('Scanner options:', scanOptions);
logger.log("Scanner options:", scanOptions);
const result = await BarcodeScanner.scan(scanOptions);
logger.log('Scan result:', result);
logger.log("Scan result:", result);
if (result.barcodes.length > 0) {
this.scanListener?.onScan(result.barcodes[0].rawValue);