Applied code formatting rules

This commit is contained in:
Bernd Bestel 2025-03-21 17:12:10 +01:00
parent 2b1d6ebfa2
commit 4717375044
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -78,8 +78,10 @@ Grocy.Components.CameraBarcodeScanner.StartScanning = function()
Grocy.Components.CameraBarcodeScanner.Scanner.decodeFromVideoDevice( Grocy.Components.CameraBarcodeScanner.Scanner.decodeFromVideoDevice(
window.localStorage.getItem('cameraId'), window.localStorage.getItem('cameraId'),
document.querySelector("#camerabarcodescanner-livestream"), document.querySelector("#camerabarcodescanner-livestream"),
(result, error) => { (result, error) =>
if (error) { {
if (error)
{
return; return;
} }
@ -90,7 +92,8 @@ Grocy.Components.CameraBarcodeScanner.StartScanning = function()
$(".modal").last().modal("hide"); $(".modal").last().modal("hide");
} }
) )
.then(() => { .then(() =>
{
Grocy.Components.CameraBarcodeScanner.CheckCapabilities(); Grocy.Components.CameraBarcodeScanner.CheckCapabilities();
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA) if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA)
@ -101,7 +104,8 @@ Grocy.Components.CameraBarcodeScanner.StartScanning = function()
}, 250); }, 250);
} }
}) })
.catch((error) => { .catch((error) =>
{
Grocy.FrontendHelpers.ShowGenericError("Error while initializing the barcode scanning library", error.message); Grocy.FrontendHelpers.ShowGenericError("Error while initializing the barcode scanning library", error.message);
toastr.info(__t("Camera access is only possible when supported and allowed by your browser and when Grocy is served via a secure (https://) connection")); toastr.info(__t("Camera access is only possible when supported and allowed by your browser and when Grocy is served via a secure (https://) connection"));
window.localStorage.removeItem("cameraId"); window.localStorage.removeItem("cameraId");
@ -165,7 +169,8 @@ $(document).on("click", "#camerabarcodescanner-start-button", async function(e)
className: 'btn-warning responsive-button torch', className: 'btn-warning responsive-button torch',
callback: function() callback: function()
{ {
if (Grocy.Components.CameraBarcodeScanner.Scanner.stream) { if (Grocy.Components.CameraBarcodeScanner.Scanner.stream)
{
Grocy.Components.CameraBarcodeScanner.TorchToggle(Grocy.Components.CameraBarcodeScanner.Scanner.stream.getVideoTracks()[0]); Grocy.Components.CameraBarcodeScanner.TorchToggle(Grocy.Components.CameraBarcodeScanner.Scanner.stream.getVideoTracks()[0]);
} }
return false; return false;