diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle
index 8ecf2188..6c3ab69d 100644
--- a/android/app/capacitor.build.gradle
+++ b/android/app/capacitor.build.gradle
@@ -9,12 +9,13 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
+ implementation project(':capacitor-mlkit-barcode-scanning')
implementation project(':capacitor-app')
implementation project(':capacitor-camera')
implementation project(':capacitor-filesystem')
implementation project(':capacitor-share')
implementation project(':capawesome-capacitor-file-picker')
- implementation project(':capacitor-mlkit-barcode-scanning')
+
}
diff --git a/android/app/src/main/assets/capacitor.plugins.json b/android/app/src/main/assets/capacitor.plugins.json
index 30b5ba98..daf64285 100644
--- a/android/app/src/main/assets/capacitor.plugins.json
+++ b/android/app/src/main/assets/capacitor.plugins.json
@@ -1,4 +1,8 @@
[
+ {
+ "pkg": "@capacitor-mlkit/barcode-scanning",
+ "classpath": "io.capawesome.capacitorjs.plugins.mlkit.barcodescanning.BarcodeScannerPlugin"
+ },
{
"pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle
index 3351b094..d831892b 100644
--- a/android/capacitor.settings.gradle
+++ b/android/capacitor.settings.gradle
@@ -2,6 +2,9 @@
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
+include ':capacitor-mlkit-barcode-scanning'
+project(':capacitor-mlkit-barcode-scanning').projectDir = new File('../node_modules/@capacitor-mlkit/barcode-scanning/android')
+
include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
@@ -16,6 +19,3 @@ project(':capacitor-share').projectDir = new File('../node_modules/@capacitor/sh
include ':capawesome-capacitor-file-picker'
project(':capawesome-capacitor-file-picker').projectDir = new File('../node_modules/@capawesome/capacitor-file-picker/android')
-
-include ':capacitor-mlkit-barcode-scanning'
-project(':capacitor-mlkit-barcode-scanning').projectDir = new File('../node_modules/@capacitor-mlkit/barcode-scanning/android')
diff --git a/package-lock.json b/package-lock.json
index f53e005d..09fac8d2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2607,9 +2607,9 @@
}
},
"node_modules/@capacitor-mlkit/barcode-scanning": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/@capacitor-mlkit/barcode-scanning/-/barcode-scanning-6.0.0.tgz",
- "integrity": "sha512-zW5UKgFtUui9qFV8PBxPzX+07gntyt5owW4S/GhOt4xWGaoxDZWERaA+XJnXgmMxS/MnPIHX2mL+mhMd1A0enQ==",
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/@capacitor-mlkit/barcode-scanning/-/barcode-scanning-6.2.0.tgz",
+ "integrity": "sha512-XnnErDabpCUty9flugqB646ERejCxrtKcKOJrdoh9ZVLTQXUnyjxUDWOlqHVxrBHy+e86ZgpZX7D5zcaNvS0lQ==",
"funding": [
{
"type": "github",
@@ -10544,9 +10544,9 @@
}
},
"node_modules/@veramo/did-provider-peer/node_modules/did-jwt": {
- "version": "8.0.11",
- "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-8.0.11.tgz",
- "integrity": "sha512-Uz2BRDr/PoLyXXPLSziNVVvFc3XgZCnB2bDla+5/FGgbdbWDzVqOyTUMxSNbUlsmrmHeZMH3KnaybW+PfplGNA==",
+ "version": "8.0.12",
+ "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-8.0.12.tgz",
+ "integrity": "sha512-tfKeyT/5RkfvUVj/yIKi3ytElQsSj7Aq8V6zIX0gXFf4tVde32m3zJr4GJqlQiRyb7QE91zSsnyOXiWCPMZIXw==",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^1.0.0",
@@ -10561,9 +10561,9 @@
}
},
"node_modules/@veramo/did-provider-peer/node_modules/did-jwt-vc": {
- "version": "4.0.9",
- "resolved": "https://registry.npmjs.org/did-jwt-vc/-/did-jwt-vc-4.0.9.tgz",
- "integrity": "sha512-kDpVLZFf2nO/taasDR3Hw/ow56pZFZzI677urWhAELach+3Q6lijQhBMNnuAyjUVWr1NiHOnBp1QHzBBf8zN7w==",
+ "version": "4.0.10",
+ "resolved": "https://registry.npmjs.org/did-jwt-vc/-/did-jwt-vc-4.0.10.tgz",
+ "integrity": "sha512-Ctxnrdqzk1FbIB+EP9hDnrBnQZ2Fye59YpoooqxhqtHGFQKuX90FdeWHMdEA/En6/DM59eCVoTOwzvk2NEc+BQ==",
"license": "ISC",
"dependencies": {
"did-jwt": "^8.0.0",
@@ -15413,9 +15413,9 @@
}
},
"node_modules/electron-to-chromium": {
- "version": "1.5.139",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.139.tgz",
- "integrity": "sha512-GGnRYOTdN5LYpwbIr0rwP/ZHOQSvAF6TG0LSzp28uCBb9JiXHJGmaaKw29qjNJc5bGnnp6kXJqRnGMQoELwi5w==",
+ "version": "1.5.140",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.140.tgz",
+ "integrity": "sha512-o82Rj+ONp4Ip7Cl1r7lrqx/pXhbp/lh9DpKcMNscFJdh8ebyRofnc7Sh01B4jx403RI0oqTBvlZ7OBIZLMr2+Q==",
"devOptional": true,
"license": "ISC"
},
@@ -16256,9 +16256,9 @@
}
},
"node_modules/ethr-did/node_modules/did-jwt": {
- "version": "8.0.11",
- "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-8.0.11.tgz",
- "integrity": "sha512-Uz2BRDr/PoLyXXPLSziNVVvFc3XgZCnB2bDla+5/FGgbdbWDzVqOyTUMxSNbUlsmrmHeZMH3KnaybW+PfplGNA==",
+ "version": "8.0.12",
+ "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-8.0.12.tgz",
+ "integrity": "sha512-tfKeyT/5RkfvUVj/yIKi3ytElQsSj7Aq8V6zIX0gXFf4tVde32m3zJr4GJqlQiRyb7QE91zSsnyOXiWCPMZIXw==",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^1.0.0",
diff --git a/src/components/QRScanner/QRScannerDialog.vue b/src/components/QRScanner/QRScannerDialog.vue
index 49f0b471..4e102aaf 100644
--- a/src/components/QRScanner/QRScannerDialog.vue
+++ b/src/components/QRScanner/QRScannerDialog.vue
@@ -33,7 +33,10 @@
-
+
- {{ isNativePlatform ? 'Using native camera scanner...' : 'QR code scanning is not supported in this browser.' }}
+ {{
+ isNativePlatform
+ ? "Using native camera scanner..."
+ : "QR code scanning is not supported in this browser."
+ }}
@@ -86,20 +93,24 @@ export default class QRScannerDialog extends Vue {
visible = true;
error: string | null = null;
useQRReader = __USE_QR_READER__;
- isNativePlatform = Capacitor.isNativePlatform() || __IS_MOBILE__ || Capacitor.getPlatform() === 'android' || Capacitor.getPlatform() === 'ios';
+ isNativePlatform =
+ Capacitor.isNativePlatform() ||
+ __IS_MOBILE__ ||
+ Capacitor.getPlatform() === "android" ||
+ Capacitor.getPlatform() === "ios";
created() {
- logger.log('QRScannerDialog platform detection:', {
+ logger.log("QRScannerDialog platform detection:", {
capacitorNative: Capacitor.isNativePlatform(),
isMobile: __IS_MOBILE__,
platform: Capacitor.getPlatform(),
useQRReader: this.useQRReader,
- isNativePlatform: this.isNativePlatform
+ isNativePlatform: this.isNativePlatform,
});
// If on native platform, close immediately and don't initialize web scanner
if (this.isNativePlatform) {
- logger.log('Closing QR dialog on native platform');
+ logger.log("Closing QR dialog on native platform");
this.$nextTick(() => this.close());
}
}
@@ -107,7 +118,7 @@ export default class QRScannerDialog extends Vue {
async onInit(promise: Promise
): Promise {
// Don't initialize on mobile platforms
if (this.isNativePlatform) {
- logger.log('Skipping web scanner initialization on native platform');
+ logger.log("Skipping web scanner initialization on native platform");
return;
}
diff --git a/src/env.d.ts b/src/env.d.ts
index 48eca19e..932a8e42 100644
--- a/src/env.d.ts
+++ b/src/env.d.ts
@@ -1,4 +1,4 @@
///
declare const __USE_QR_READER__: boolean;
-declare const __IS_MOBILE__: boolean;
\ No newline at end of file
+declare const __IS_MOBILE__: boolean;
diff --git a/src/services/QRScanner/CapacitorQRScanner.ts b/src/services/QRScanner/CapacitorQRScanner.ts
index 81734c5b..1fcb644b 100644
--- a/src/services/QRScanner/CapacitorQRScanner.ts
+++ b/src/services/QRScanner/CapacitorQRScanner.ts
@@ -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);
diff --git a/src/services/QRScanner/QRScannerFactory.ts b/src/services/QRScanner/QRScannerFactory.ts
index 768af276..fc8e9b49 100644
--- a/src/services/QRScanner/QRScannerFactory.ts
+++ b/src/services/QRScanner/QRScannerFactory.ts
@@ -14,16 +14,16 @@ export class QRScannerFactory {
const capacitorNative = Capacitor.isNativePlatform();
const isMobile = __IS_MOBILE__;
const platform = Capacitor.getPlatform();
-
- logger.log('Platform detection:', {
+
+ logger.log("Platform detection:", {
capacitorNative,
isMobile,
platform,
- userAgent: navigator.userAgent
+ userAgent: navigator.userAgent,
});
// Force native scanner on Android/iOS
- if (platform === 'android' || platform === 'ios') {
+ if (platform === "android" || platform === "ios") {
return true;
}
@@ -36,16 +36,20 @@ export class QRScannerFactory {
static getInstance(): QRScannerService {
if (!this.instance) {
const isNative = this.isNativePlatform();
- logger.log(`Creating QR scanner for platform: ${isNative ? 'native' : 'web'}`);
-
+ logger.log(
+ `Creating QR scanner for platform: ${isNative ? "native" : "web"}`,
+ );
+
if (isNative) {
- logger.log('Using native MLKit scanner');
+ logger.log("Using native MLKit scanner");
this.instance = new CapacitorQRScanner();
} else if (__USE_QR_READER__) {
- logger.log('Using web QR scanner');
+ logger.log("Using web QR scanner");
this.instance = new WebDialogQRScanner();
} else {
- throw new Error("No QR scanner implementation available for this platform");
+ throw new Error(
+ "No QR scanner implementation available for this platform",
+ );
}
}
return this.instance!; // We know it's not null here
diff --git a/src/services/platforms/CapacitorPlatformService.ts b/src/services/platforms/CapacitorPlatformService.ts
index 9c655eb6..ee8f2f82 100644
--- a/src/services/platforms/CapacitorPlatformService.ts
+++ b/src/services/platforms/CapacitorPlatformService.ts
@@ -318,12 +318,12 @@ export class CapacitorPlatformService implements PlatformService {
async writeAndShareFile(fileName: string, content: string): Promise {
const timestamp = new Date().toISOString();
const logData = {
- action: 'writeAndShareFile',
+ action: "writeAndShareFile",
fileName,
contentLength: content.length,
timestamp,
};
- logger.log('[CapacitorPlatformService]', JSON.stringify(logData, null, 2));
+ logger.log("[CapacitorPlatformService]", JSON.stringify(logData, null, 2));
try {
const { uri } = await Filesystem.writeFile({
@@ -334,13 +334,16 @@ export class CapacitorPlatformService implements PlatformService {
recursive: true,
});
- logger.log('[CapacitorPlatformService] File write successful:', { uri, timestamp: new Date().toISOString() });
+ logger.log("[CapacitorPlatformService] File write successful:", {
+ uri,
+ timestamp: new Date().toISOString(),
+ });
await Share.share({
- title: 'TimeSafari Backup',
- text: 'Here is your backup file.',
+ title: "TimeSafari Backup",
+ text: "Here is your backup file.",
url: uri,
- dialogTitle: 'Share your backup file',
+ dialogTitle: "Share your backup file",
});
} catch (error) {
const err = error as Error;
@@ -349,7 +352,10 @@ export class CapacitorPlatformService implements PlatformService {
stack: err.stack,
timestamp: new Date().toISOString(),
};
- logger.error('[CapacitorPlatformService] Error writing or sharing file:', JSON.stringify(errLog, null, 2));
+ logger.error(
+ "[CapacitorPlatformService] Error writing or sharing file:",
+ JSON.stringify(errLog, null, 2),
+ );
throw new Error(`Failed to write or share file: ${err.message}`);
}
}