@ -101,7 +101,8 @@
< path
< path
class = "opacity-75"
class = "opacity-75"
fill = "currentColor"
fill = "currentColor"
d = "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
d = " M4 12 a8 8 0 018 - 8 V0C5 .373 0 0 5.373 0 12 h4zm2 5.291 A7 .962 7.962 0 014 12 H0c0
3.042 1.135 5.824 3 7.938 l3 - 2.647 z "
> < / path >
> < / path >
< / svg >
< / svg >
< span > { { initializationStatus } } < / span >
< span > { { initializationStatus } } < / span >
@ -119,9 +120,7 @@
< span class = "font-medium" > Error : < / span > { { error } }
< span class = "font-medium" > Error : < / span > { { error } }
< / p >
< / p >
< p v -else class = "flex items-center justify-center space-x-2" >
< p v -else class = "flex items-center justify-center space-x-2" >
< span
< span class = "inline-block w-2 h-2 bg-blue-500 rounded-full" > < / span >
class = "inline-block w-2 h-2 bg-blue-500 rounded-full"
> < / span >
< span > Ready to scan < / span >
< span > Ready to scan < / span >
< / p >
< / p >
< / div >
< / div >
@ -152,8 +151,8 @@
< div
< div
class = "absolute bottom-16 left-0 right-0 bg-black bg-opacity-50 text-white text-xs text-center py-1"
class = "absolute bottom-16 left-0 right-0 bg-black bg-opacity-50 text-white text-xs text-center py-1"
>
>
Camera : { { preferredCamera === "user" ? "Front" : "Back" } } |
Camera : { { preferredCamera === "user" ? "Front" : "Back" } } | Status :
Status : { { cameraStatus } }
{ { cameraStatus } }
< / div >
< / div >
<!-- Camera Switch Button -- >
<!-- Camera Switch Button -- >
@ -172,7 +171,9 @@
stroke - linecap = "round"
stroke - linecap = "round"
stroke - linejoin = "round"
stroke - linejoin = "round"
stroke - width = "2"
stroke - width = "2"
d = "M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"
d = " M3 9 a2 2 0 012 - 2 h .93 a2 2 0 001.664 - .89 l .812 - 1.22 A2 2 0 0110.07 4 h3 .86 a2 2 0
011.664 .89 l .812 1.22 A2 2 0 0018.07 7 H19a2 2 0 012 2 v9a2 2 0 01 - 2 2 H5a2 2 0
01 - 2 - 2 V9z "
/ >
/ >
< path
< path
stroke - linecap = "round"
stroke - linecap = "round"
@ -186,15 +187,15 @@
< div v-else >
< div v-else >
< button
< button
v - if = "isNativePlatform"
v - if = "isNativePlatform"
@ click = "$router.push({ name: 'contact-qr-scan' })"
class = "bg-blue-500 text-white px-4 py-2 rounded-md mt-4"
class = "bg-blue-500 text-white px-4 py-2 rounded-md mt-4"
@ click = "$router.push({ name: 'contact-qr-scan' })"
>
>
Start Scanning
Start Scanning
< / button >
< / button >
< button
< button
v - else
v - else
@ click = "startScanning"
class = "bg-blue-500 text-white px-4 py-2 rounded-md mt-4"
class = "bg-blue-500 text-white px-4 py-2 rounded-md mt-4"
@ click = "startScanning"
>
>
Start Scanning
Start Scanning
< / button >
< / button >
@ -233,7 +234,6 @@ import { retrieveAccountMetadata } from "../libs/util";
import { Router } from "vue-router" ;
import { Router } from "vue-router" ;
import { logger } from "../utils/logger" ;
import { logger } from "../utils/logger" ;
import { QRScannerFactory } from "@/services/QRScanner/QRScannerFactory" ;
import { QRScannerFactory } from "@/services/QRScanner/QRScannerFactory" ;
import { WebInlineQRScanner } from "@/services/QRScanner/WebInlineQRScanner" ;
interface QRScanResult {
interface QRScanResult {
rawValue ? : string ;
rawValue ? : string ;
@ -842,7 +842,8 @@ export default class ContactQRScanShow extends Vue {
this . isInitializing = false ;
this . isInitializing = false ;
this . cameraStatus = "Ready" ;
this . cameraStatus = "Ready" ;
} catch ( error ) {
} catch ( error ) {
const wrappedError = error instanceof Error ? error : new Error ( String ( error ) ) ;
const wrappedError =
error instanceof Error ? error : new Error ( String ( error ) ) ;
this . error = wrappedError . message ;
this . error = wrappedError . message ;
this . cameraStatus = "Error" ;
this . cameraStatus = "Error" ;
this . isInitializing = false ;
this . isInitializing = false ;
@ -862,12 +863,16 @@ export default class ContactQRScanShow extends Vue {
this . cameraStatus = "Off" ;
this . cameraStatus = "Off" ;
}
}
onDetect ( result : any ) : void {
onDetect ( result : unknown ) : void {
this . isScanning = true ;
this . isScanning = true ;
this . cameraStatus = "Detecting" ;
this . cameraStatus = "Detecting" ;
try {
try {
let rawValue : string | undefined ;
let rawValue : string | undefined ;
if ( Array . isArray ( result ) && result . length > 0 && "rawValue" in result [ 0 ] ) {
if (
Array . isArray ( result ) &&
result . length > 0 &&
"rawValue" in result [ 0 ]
) {
rawValue = result [ 0 ] . rawValue ;
rawValue = result [ 0 ] . rawValue ;
} else if ( result && typeof result === "object" && "rawValue" in result ) {
} else if ( result && typeof result === "object" && "rawValue" in result ) {
rawValue = result . rawValue ;
rawValue = result . rawValue ;
@ -896,11 +901,13 @@ export default class ContactQRScanShow extends Vue {
}
}
toggleCamera ( ) : void {
toggleCamera ( ) : void {
this . preferredCamera = this . preferredCamera === "user" ? "environment" : "user" ;
this . preferredCamera =
this . preferredCamera === "user" ? "environment" : "user" ;
}
}
private handleError ( error : unknown ) : void {
private handleError ( error : unknown ) : void {
const wrappedError = error instanceof Error ? error : new Error ( String ( error ) ) ;
const wrappedError =
error instanceof Error ? error : new Error ( String ( error ) ) ;
this . error = wrappedError . message ;
this . error = wrappedError . message ;
this . cameraStatus = "Error" ;
this . cameraStatus = "Error" ;
}
}