Improve UX for map calibration prompt. Close #62, close #63.

Skylar Ittner 2 years ago
parent a705ccb846
commit c809dce865

@ -220,7 +220,7 @@ function importPackageList(newlist) {
function mapCalibrate(item, packagesentry) {
// Determine if the delivery location isn't near the map pin
if (userPosition.coords.accuracy < 20 && timeDiff(userPosition.updated) < 10) {
if (getStorage("mapcalibrate") !== "false" && userPosition.coords.accuracy < 20 && timeDiff(userPosition.updated) < 10) {
// User location is accurate, check distance
var distance = getDistance(packagesentry.coords[0], packagesentry.coords[1], userPosition.coords.latitude, userPosition.coords.longitude);
var lat = userPosition.coords.latitude;
@ -262,43 +262,62 @@ function mapCalibrate(item, packagesentry) {
};
app.dialog.create({
title: 'Map Calibration',
text: "Your actual location doesn't match the map location for the " + SETTINGS.itemtypes[item.type].name + " at " + item.address + ". Where are you?",
title: 'Question',
text: "Are you currently at the correct delivery location for the " + SETTINGS.itemtypes[item.type].name + " at " + item.address + "?",
buttons: [
{
text: 'Address',
text: "No",
close: true
},
{
text: 'Mailbox/CBU',
close: true
},
{
text: 'Parcel Locker',
close: true
},
{
text: "Other/Cancel",
text: "Yes",
close: true
}
],
verticalButtons: true,
onClick: function (dialog, index) {
switch (index) {
case 0:
fixmap(item, lat, lon, "address", packagesentry);
break;
case 1:
fixmap(item, lat, lon, "mailbox", packagesentry);
break;
case 2:
fixmap(item, lat, lon, "locker", packagesentry);
break;
default:
return;
if (index == 1) {
app.dialog.create({
title: 'Map Calibration',
text: "Your actual location doesn't match the expected location for the " + SETTINGS.itemtypes[item.type].name + " at " + item.address + ". Where are you?",
buttons: [
{
text: 'Address',
close: true
},
{
text: 'Mailbox/CBU',
close: true
},
{
text: 'Parcel Locker',
close: true
},
{
text: "Other/Cancel",
close: true
}
],
verticalButtons: true,
onClick: function (dialog, index) {
switch (index) {
case 0:
fixmap(item, lat, lon, "address", packagesentry);
break;
case 1:
fixmap(item, lat, lon, "mailbox", packagesentry);
break;
case 2:
fixmap(item, lat, lon, "locker", packagesentry);
break;
default:
return;
}
}
}).open();
}
}
}).open();
}
}
}

@ -138,6 +138,11 @@ $('.item-content[data-setting=alertinterval] .range-slider').on('range:changed',
setStorage("alertinterval", val);
});
$('.item-content[data-setting=mapcalibrate] .toggle input').on("change", function () {
var checked = $(this).prop('checked');
setStorage("mapcalibrate", checked ? "true" : "false");
});
$('.item-link[data-setting=mapsource] select').on("change", function () {
setStorage("mapsource", $('.item-link[data-setting=mapsource] select').val());

@ -702,6 +702,14 @@ var routes = [
}
]
},
{
setting: "mapcalibrate",
title: "Map Calibration",
text: "Ask where you are when delivering a package if the map is wrong.",
toggle: true,
checked: getStorage("mapcalibrate") !== "false",
onclick: ""
},
{
setting: "mapscale",
title: "Map Scale Ruler",

Loading…
Cancel
Save