diff --git a/www/assets/js/location.js b/www/assets/js/location.js index e13cc93..9d5dbc6 100644 --- a/www/assets/js/location.js +++ b/www/assets/js/location.js @@ -32,11 +32,18 @@ if ("geolocation" in navigator) { //map.updatePackageLayer(packages); } + var alertinterval = localStorage.getItem("alertinterval"); + if (alertinterval == null) { + alertinterval = 30; + } else { + alertinterval = alertinterval * 1; + } + lastGpsUpdateTimestamp = currentTimestamp; for (var i = 0; i < packages.length; i++) { if (packages[i].distance * 1 < localStorage.getItem("alertradius") * 1) { - if (packages[i].lastAlert > currentTimestamp - 30) { + if (packages[i].lastAlert > currentTimestamp - alertinterval) { continue; } diff --git a/www/assets/js/settings.js b/www/assets/js/settings.js index bb59469..c091ec5 100644 --- a/www/assets/js/settings.js +++ b/www/assets/js/settings.js @@ -59,6 +59,11 @@ $('.item-content[data-setting=alertvolume] .range-slider').on('range:changed', f playSound("alert"); }); +$('.item-content[data-setting=alertinterval] .range-slider').on('range:changed', function (e, range) { + var val = app.range.get(".item-content[data-setting=alertinterval] .range-slider").getValue(); + localStorage.setItem("alertinterval", val); +}); + function pickAlertSound() { var currentalertsound = localStorage.getItem("alertsound"); app.dialog.create({ @@ -155,8 +160,4 @@ function pickMapSource() { reloadMap(); } }).open(); -} - -function formatPercentLabel(value) { - return value + "%"; } \ No newline at end of file diff --git a/www/pages/settings.html b/www/pages/settings.html index 7b3f88f..f911db3 100644 --- a/www/pages/settings.html +++ b/www/pages/settings.html @@ -42,12 +42,12 @@ {{#if slider}}
-
+
{{title}}
-
-
- +
+
+
diff --git a/www/routes.js b/www/routes.js index 827d912..e02cd66 100644 --- a/www/routes.js +++ b/www/routes.js @@ -82,19 +82,28 @@ var routes = [ settings: [ { setting: "alertsound", - title: "Alert Sound", + title: "Alert sound", text: "Select which sound to play when a package is nearby.", onclick: "pickAlertSound()" }, { setting: "alertvolume", - title: "Alert Volume", + title: "Alert volume", min: 0, max: 100, - step: 5, + step: 1, value: localStorage.getItem("alertvolume"), slider: true }, + { + setting: "alertinterval", + title: "Alert interval (seconds)", + min: 15, + max: 120, + step: 15, + value: localStorage.getItem("alertinterval") == null ? 30 : localStorage.getItem("alertinterval"), + slider: true + }, { setting: "wakelock", title: "Keep screen on", @@ -113,7 +122,7 @@ var routes = [ }, { setting: "units", - title: "Distance Units", + title: "Measurement units", text: "Use feet and miles for showing distance", toggle: true, checked: localStorage.getItem("units") == "imperial", @@ -121,8 +130,8 @@ var routes = [ }, { setting: "mapsource", - title: "Map", - text: "Choose which map to use.", + title: "Map style", + text: "Choose which map style to use.", onclick: "pickMapSource()" }, { @@ -133,13 +142,13 @@ var routes = [ }, { setting: "opensource", - title: "Credits and Open Source", + title: "Credits and open source info", text: "", onclick: "router.navigate('/credits')" }, { setting: "privacy", - title: "Privacy Policy and Terms", + title: "Privacy policy and legal", text: "", onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=PackageHelpterApp')" }]