further hardening

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-10-22 11:25:48 -06:00
parent 30f35855f2
commit 272596878c
4 changed files with 26 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@@ -263,10 +263,10 @@ function startRecording() {
});
});
} catch (err) {
errorSwal('Location Services not Enabled');
errorToast('Location Services not Enabled');
}
} else {
errorSwal('Browser does not support GeoLocation and/or WakeLock API');
errorToast('Browser does not support GeoLocation and/or WakeLock API');
}
}
function recordPosition(position) {
@@ -298,7 +298,17 @@ function recordPosition(position) {
}
}
}
function stopRecording() {
function stopRecording(errMsg) {
if (errMsg && errMsg.code) {
switch (errMsg.code) {
case 1:
errorToast(errMsg.message);
break;
case 2:
errorToast("Location Unavailable");
break;
}
}
if (tripTimer != undefined) {
clearInterval(tripTimer);
tripTimer = undefined;
@@ -364,4 +374,12 @@ function toggleSubOdometer() {
} else {
$(".trip-odometer-sub").addClass("d-none");
}
}
function checkTripRecorder() {
//check if connection is https, browser supports required API, and that vehicle does not use engine hours
if (location.protocol != 'https:' || !navigator.geolocation || !navigator.wakeLock || GetVehicleId().useEngineHours) {
$(".trip-show").remove();
} else {
$(".trip-show").removeClass('d-none');
}
}