Add setting to manually clear the tile and geocode caches

Skylar Ittner 4 years ago
parent 410a410d35
commit 50321d2bdc

@ -20,16 +20,29 @@ function logout() {
function resyncAndRestart() {
app.toast.show({
text: "Syncing settings and restarting...",
position: "bottom",
destroyOnClose: true,
closeTimeout: 1000 * 10
});
text: "Syncing settings and restarting...",
position: "bottom",
destroyOnClose: true,
closeTimeout: 1000 * 10
});
syncNow(function () {
restartApplication();
});
}
function clearCaches() {
app.toast.show({
text: "Clearing caches. You may need to restart the app to see a difference.",
position: "bottom",
destroyOnClose: true,
closeTimeout: 1000 * 10
});
setStorage("geocode_cache", "{}");
if ('caches' in window) {
clearAllCaches();
}
}
$('.item-content[data-setting=darktheme] .toggle input').on("change", function () {
var checked = $(this).prop('checked');
setStorage("darktheme", checked);

@ -113,7 +113,6 @@ var cachedurls = [
'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff',
'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff2'
];
for (i in SETTINGS.maptileurls) {
cachedurls.push(SETTINGS.maptileurls[i].json);
}
@ -157,4 +156,12 @@ function fillCache(cachename) {
}, 1000 * 30);
}
}
}
async function clearAllCaches() {
const keys = await caches.keys();
for (const key of keys) {
caches.delete(key);
}
}

@ -388,6 +388,13 @@ var routes = [
text: "",
onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=PackageHelperApp')",
link: true
},
{
setting: "clearcache",
title: "Clear Cache",
text: "Delete saved maps and other temporary data",
link: true,
onclick: "clearCaches()"
});
resolve({
templateUrl: './pages/settings.html'

Loading…
Cancel
Save