Add slider to choose alert sound frequency (close #8)
This commit is contained in:
parent
87ee63efb5
commit
6c43a7df6e
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 + "%";
|
||||
}
|
@ -42,12 +42,12 @@
|
||||
{{#if slider}}
|
||||
<div class="item-content" data-setting="{{setting}}">
|
||||
<div class="item-inner">
|
||||
<div class="item-title">
|
||||
<div class="item-title" style="background-color: rgba(0,0,0,0);">
|
||||
{{title}}
|
||||
</div>
|
||||
<div class="item-subtitle padding-horizontal-half">
|
||||
<div class="range-slider range-slider-init">
|
||||
<input type="range" min="{{min}}" max="{{max}}" step="{{step}}" label="true" formatLabel="formatPercentLabel(value)" value="{{value}}">
|
||||
<div class="item-subtitle padding-horizontal padding-top">
|
||||
<div class="range-slider range-slider-init padding-top margin-top" data-label="true">
|
||||
<input type="range" min="{{min}}" max="{{max}}" step="{{step}}" value="{{value}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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')"
|
||||
}]
|
||||
|
Loading…
x
Reference in New Issue
Block a user