Add camera access error message
This commit is contained in:
parent
029080a8cd
commit
8e38eb3550
|
@ -10,7 +10,7 @@ function Alert(props: AlertProps): JSX.Element {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 mt-5 rounded relative" role="alert">
|
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 mt-5 rounded relative" role="alert">
|
||||||
<span className="block sm:inline" id="message">{props.errorMessage}</span>
|
<span className="block sm:inline pr-6" id="message">{props.errorMessage}</span>
|
||||||
<span className="absolute top-0 bottom-0 right-0 px-4 py-3" onClick={props.onClose}>
|
<span className="absolute top-0 bottom-0 right-0 px-4 py-3" onClick={props.onClose}>
|
||||||
<svg className="fill-current h-6 w-6 text-red-500" role="button" xmlns="http://www.w3.org/2000/svg"
|
<svg className="fill-current h-6 w-6 text-red-500" role="button" xmlns="http://www.w3.org/2000/svg"
|
||||||
viewBox="0 0 20 20">
|
viewBox="0 0 20 20">
|
||||||
|
|
|
@ -29,6 +29,11 @@ function Form(): JSX.Element {
|
||||||
|
|
||||||
// Check if there is a translation and replace message accordingly
|
// Check if there is a translation and replace message accordingly
|
||||||
const setErrorMessage = (message: string) => {
|
const setErrorMessage = (message: string) => {
|
||||||
|
if (message == undefined) {
|
||||||
|
_setErrorMessage(undefined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const translation = t('errors:'.concat(message));
|
const translation = t('errors:'.concat(message));
|
||||||
_setErrorMessage(translation !== message ? translation : message);
|
_setErrorMessage(translation !== message ? translation : message);
|
||||||
};
|
};
|
||||||
|
@ -68,7 +73,13 @@ function Form(): JSX.Element {
|
||||||
const codeReader = new BrowserQRCodeReader();
|
const codeReader = new BrowserQRCodeReader();
|
||||||
|
|
||||||
// Needs to be called before any camera can be accessed
|
// Needs to be called before any camera can be accessed
|
||||||
await BrowserQRCodeReader.listVideoInputDevices();
|
const deviceList = await BrowserQRCodeReader.listVideoInputDevices();
|
||||||
|
|
||||||
|
// Check access to camera device
|
||||||
|
if (deviceList.length == 0) {
|
||||||
|
setErrorMessage("noCameraAccess");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get preview Element to show camera stream
|
// Get preview Element to show camera stream
|
||||||
const previewElem: HTMLVideoElement = document.querySelector('#cameraPreview');
|
const previewElem: HTMLVideoElement = document.querySelector('#cameraPreview');
|
||||||
|
|
|
@ -14,4 +14,5 @@ couldNotFindQrCode: QR-Code konnte in der ausgewählten Datei nicht gefunden wer
|
||||||
invalidQrCode: Ungültiger QR-Code
|
invalidQrCode: Ungültiger QR-Code
|
||||||
certificateType: Kein gültiger Zertifikatstyp gefunden
|
certificateType: Kein gültiger Zertifikatstyp gefunden
|
||||||
invalidTestResult: Ungültiges Testergebnis
|
invalidTestResult: Ungültiges Testergebnis
|
||||||
invalidTestType: Ungültiger Testtyp
|
invalidTestType: Ungültiger Testtyp
|
||||||
|
noCameraAccess: Kein Zugriff auf die Kamera möglich. Überprüfe die Berechtigungen unter Einstellungen > Safari > Kamera.
|
|
@ -14,4 +14,5 @@ couldNotFindQrCode: Could not find QR Code in provided file
|
||||||
invalidQrCode: Invalid QR code
|
invalidQrCode: Invalid QR code
|
||||||
certificateType: No valid certificate type found
|
certificateType: No valid certificate type found
|
||||||
invalidTestResult: Invalid test result
|
invalidTestResult: Invalid test result
|
||||||
invalidTestType: Invalid test type
|
invalidTestType: Invalid test type
|
||||||
|
noCameraAccess: Could not access camera. Check permissions under Settings > Safari > Camera.
|
|
@ -14,4 +14,5 @@ couldNotFindQrCode: QR-koodia ei löytynyt annetusta tiedostosta
|
||||||
invalidQrCode: Virheellinen QR-koodi
|
invalidQrCode: Virheellinen QR-koodi
|
||||||
certificateType: Kelvollista varmennetyyppiä ei löytynyt
|
certificateType: Kelvollista varmennetyyppiä ei löytynyt
|
||||||
invalidTestResult: Virheellinen testitulos
|
invalidTestResult: Virheellinen testitulos
|
||||||
invalidTestType: Virheellinen testityyppi
|
invalidTestType: Virheellinen testityyppi
|
||||||
|
noCameraAccess: Kameraan ei päässyt käsiksi. Tarkista käyttöoikeudet kohdasta Asetukset > Safari > Kamera.
|
|
@ -14,4 +14,5 @@ couldNotFindQrCode: Impossible de trouver le QR Code dans le fichier fourni
|
||||||
invalidQrCode: QR Code non valide
|
invalidQrCode: QR Code non valide
|
||||||
certificateType: Aucun type de certificat valide n'a été trouvé
|
certificateType: Aucun type de certificat valide n'a été trouvé
|
||||||
invalidTestResult: Résultat du test non valide
|
invalidTestResult: Résultat du test non valide
|
||||||
invalidTestType: Type de test non valide
|
invalidTestType: Type de test non valide
|
||||||
|
noCameraAccess: Impossible d'accéder à la caméra. Vérifiez les autorisations sous Paramètres > Safari > Appareil photo.
|
|
@ -14,4 +14,5 @@ couldNotFindQrCode: Kon de QR-code niet vinden in het verstrekte bestand
|
||||||
invalidQrCode: Ongeldige QR-code
|
invalidQrCode: Ongeldige QR-code
|
||||||
certificateType: Geen geldig certificaattype gevonden
|
certificateType: Geen geldig certificaattype gevonden
|
||||||
invalidTestResult: Ongeldig testresultaat
|
invalidTestResult: Ongeldig testresultaat
|
||||||
invalidTestType: Ongeldig testtype
|
invalidTestType: Ongeldig testtype
|
||||||
|
noCameraAccess: Kon geen toegang krijgen tot de camera. Controleer de machtigingen onder Instellingen > Safari > Camera.
|
Loading…
Reference in New Issue