@ -273,7 +273,7 @@ export default class QRScannerDialog extends Vue {
}
}
}
}
async onInit ( promise : Promise < void > ) : Promise < void > {
async onInit ( promise : Promise < void > , attempt = 1 ) : Promise < void > {
if ( this . isNativePlatform ) {
if ( this . isNativePlatform ) {
logger . log ( "Skipping web scanner initialization on native platform" ) ;
logger . log ( "Skipping web scanner initialization on native platform" ) ;
return ;
return ;
@ -350,12 +350,17 @@ export default class QRScannerDialog extends Vue {
/ / N o w i n i t i a l i z e t h e Q R s c a n n e r
/ / N o w i n i t i a l i z e t h e Q R s c a n n e r
this . initializationStatus = "Starting QR scanner..." ;
this . initializationStatus = "Starting QR scanner..." ;
logger . log ( "Initializing QR scanner..." ) ;
logger . log ( "Initializing QR scanner..." ) ;
/ / a w a i t p r o m i s e ; / / < - - c o m m e n t t h i s o u t f o r d e b u g g i n g
await promise ;
this . isInitializing = false ;
this . isInitializing = false ;
this . cameraStatus = "Ready" ;
this . cameraStatus = "Ready" ;
logger . log ( "QR scanner initialized successfully" ) ;
logger . log ( "QR scanner initialized successfully" ) ;
} catch ( error ) {
} catch ( error ) {
if ( attempt < 3 ) {
/ / R e t r y a f t e r a s h o r t d e l a y
setTimeout ( ( ) => this . onInit ( promise , attempt + 1 ) , 1500 ) ;
this . initializationStatus = ` Retrying camera initialization (attempt ${ attempt + 1 } )... ` ;
return ;
}
const wrappedError =
const wrappedError =
error instanceof Error ? error : new Error ( String ( error ) ) ;
error instanceof Error ? error : new Error ( String ( error ) ) ;
this . error = wrappedError . message ;
this . error = wrappedError . message ;