forked from jsnbuchanan/crowd-funder-for-time-pwa
chore: cleanup and test
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user