BangleApps/apps/iconlaunch/settings.js

54 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-05-24 00:18:26 +00:00
// make sure to enclose the function in parentheses
(function(back) {
const s = require("Storage");
2022-05-24 00:18:26 +00:00
let settings = Object.assign({
showClocks: true,
2022-10-21 16:33:16 +00:00
fullscreen: false,
direct: false,
oneClickExit: false,
swipeExit: false,
timeOut:"Off"
}, s.readJSON("iconlaunch.json", true) || {});
2022-05-24 00:18:26 +00:00
function save(key, value) {
settings[key] = value;
s.write("iconlaunch.json",settings);
2022-05-24 00:18:26 +00:00
}
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
2022-05-24 00:18:26 +00:00
const appMenu = {
"": { "title": /*LANG*/"Launcher", back: back },
2022-05-24 00:18:26 +00:00
/*LANG*/"Show Clocks": {
value: settings.showClocks == true,
onchange: (m) => {
save("showClocks", m);
s.erase("iconlaunch.cache.json"); //delete the cache app list
}
2022-05-24 00:18:26 +00:00
},
/*LANG*/"Fullscreen": {
value: settings.fullscreen == true,
onchange: (m) => { save("fullscreen", m) }
},
/*LANG*/"Direct launch": {
value: settings.direct == true,
onchange: (m) => { save("direct", m) }
},
/*LANG*/"One click exit": {
value: settings.oneClickExit == true,
onchange: (m) => { save("oneClickExit", m) }
},
2022-10-21 16:33:16 +00:00
/*LANG*/"Swipe exit": {
value: settings.swipeExit == true,
onchange: m => { save("swipeExit", m) }
},
/*LANG*/'Time Out': {
value: timeOutChoices.indexOf(settings.timeOut),
min: 0, max: timeOutChoices.length-1,
format: v => timeOutChoices[v],
onchange: m => {
save("timeOut", timeOutChoices[m]);
}
},
2022-05-24 00:18:26 +00:00
};
E.showMenu(appMenu);
});