mirror of https://github.com/espruino/BangleApps
changed the launch.json file name in iconlaunch.json ( launch.cache.json -> iconlaunch.cache.json)
used Object.assing for the settings fix cache not deleted when "showClocks" options is changed added timeOut to return to the clockpull/2227/head
parent
ba028e1f58
commit
adc59dcc16
|
@ -8,3 +8,7 @@
|
||||||
Add swipe-to-exit
|
Add swipe-to-exit
|
||||||
0.08: Only use fast loading for switching to clock to prevent problems in full screen apps
|
0.08: Only use fast loading for switching to clock to prevent problems in full screen apps
|
||||||
0.09: Remove fast load option since clocks containing Bangle.loadWidgets are now always normally loaded
|
0.09: Remove fast load option since clocks containing Bangle.loadWidgets are now always normally loaded
|
||||||
|
0.10: changed the launch.json file name in iconlaunch.json ( launch.cache.json -> iconlaunch.cache.json)
|
||||||
|
used Object.assing for the settings
|
||||||
|
fix cache not deleted when "showClocks" options is changed
|
||||||
|
added timeOut to return to the clock
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
{
|
{
|
||||||
const s = require("Storage");
|
const s = require("Storage");
|
||||||
const settings = s.readJSON("launch.json", true) || { showClocks: true, fullscreen: false,direct:false,swipeExit:false,oneClickExit:false};
|
const settings = Object.assign({
|
||||||
|
showClocks: true,
|
||||||
|
fullscreen: false,
|
||||||
|
direct: false,
|
||||||
|
oneClickExit: false,
|
||||||
|
swipeExit: false,
|
||||||
|
timeOut:"Off"
|
||||||
|
}, s.readJSON("iconlaunch.json", true) || {});
|
||||||
|
|
||||||
|
console.log(settings);
|
||||||
if (!settings.fullscreen) {
|
if (!settings.fullscreen) {
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
}
|
}
|
||||||
let launchCache = s.readJSON("launch.cache.json", true)||{};
|
let launchCache = s.readJSON("iconlaunch.cache.json", true)||{};
|
||||||
let launchHash = require("Storage").hash(/\.info/);
|
let launchHash = s.hash(/\.info/);
|
||||||
if (launchCache.hash!=launchHash) {
|
if (launchCache.hash!=launchHash) {
|
||||||
launchCache = {
|
launchCache = {
|
||||||
hash : launchHash,
|
hash : launchHash,
|
||||||
|
@ -20,7 +29,7 @@
|
||||||
if (a.name>b.name) return 1;
|
if (a.name>b.name) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}) };
|
}) };
|
||||||
s.writeJSON("launch.cache.json", launchCache);
|
s.writeJSON("iconlaunch.cache.json", launchCache);
|
||||||
}
|
}
|
||||||
let scroll = 0;
|
let scroll = 0;
|
||||||
let selectedItem = -1;
|
let selectedItem = -1;
|
||||||
|
@ -198,6 +207,11 @@
|
||||||
|
|
||||||
|
|
||||||
if (settings.oneClickExit) mode.btn = returnToClock;
|
if (settings.oneClickExit) mode.btn = returnToClock;
|
||||||
|
if (settings.timeOut!="Off"){
|
||||||
|
let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt
|
||||||
|
setTimeout(returnToClock,time*1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Bangle.setUI(mode);
|
Bangle.setUI(mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "iconlaunch",
|
"id": "iconlaunch",
|
||||||
"name": "Icon Launcher",
|
"name": "Icon Launcher",
|
||||||
"shortName" : "Icon launcher",
|
"shortName" : "Icon launcher",
|
||||||
"version": "0.09",
|
"version": "0.10",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"description": "A launcher inspired by smartphones, with an icon-only scrollable menu.",
|
"description": "A launcher inspired by smartphones, with an icon-only scrollable menu.",
|
||||||
"tags": "tool,system,launcher",
|
"tags": "tool,system,launcher",
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
{ "name": "iconlaunch.app.js", "url": "app.js" },
|
{ "name": "iconlaunch.app.js", "url": "app.js" },
|
||||||
{ "name": "iconlaunch.settings.js", "url": "settings.js" }
|
{ "name": "iconlaunch.settings.js", "url": "settings.js" }
|
||||||
],
|
],
|
||||||
|
"data": [{"name":"iconlaunch.json"},{"name":"iconlaunch.cache.json"}],
|
||||||
"screenshots": [{ "url": "screenshot1.png" }, { "url": "screenshot2.png" }],
|
"screenshots": [{ "url": "screenshot1.png" }, { "url": "screenshot2.png" }],
|
||||||
"readme": "README.md"
|
"readme": "README.md"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
// make sure to enclose the function in parentheses
|
// make sure to enclose the function in parentheses
|
||||||
(function(back) {
|
(function(back) {
|
||||||
|
const s = require("Storage");
|
||||||
let settings = Object.assign({
|
let settings = Object.assign({
|
||||||
showClocks: true,
|
showClocks: true,
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
direct: false,
|
direct: false,
|
||||||
oneClickExit: false,
|
oneClickExit: false,
|
||||||
swipeExit: false
|
swipeExit: false,
|
||||||
}, require("Storage").readJSON("launch.json", true) || {});
|
timeOut:"Off"
|
||||||
|
}, s.readJSON("iconlaunch.json", true) || {});
|
||||||
|
|
||||||
let fonts = g.getFonts();
|
|
||||||
function save(key, value) {
|
function save(key, value) {
|
||||||
settings[key] = value;
|
settings[key] = value;
|
||||||
require("Storage").write("launch.json",settings);
|
s.write("iconlaunch.json",settings);
|
||||||
}
|
}
|
||||||
|
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
|
||||||
const appMenu = {
|
const appMenu = {
|
||||||
"": { "title": /*LANG*/"Launcher" },
|
"": { "title": /*LANG*/"Launcher" },
|
||||||
/*LANG*/"< Back": back,
|
/*LANG*/"< Back": back,
|
||||||
/*LANG*/"Show Clocks": {
|
/*LANG*/"Show Clocks": {
|
||||||
value: settings.showClocks == true,
|
value: settings.showClocks == true,
|
||||||
onchange: (m) => { save("showClocks", m) }
|
onchange: (m) => {
|
||||||
|
save("showClocks", m);
|
||||||
|
s.erase("iconlaunch.cache.json"); //delete the cache app list
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/*LANG*/"Fullscreen": {
|
/*LANG*/"Fullscreen": {
|
||||||
value: settings.fullscreen == true,
|
value: settings.fullscreen == true,
|
||||||
|
@ -35,7 +40,15 @@
|
||||||
/*LANG*/"Swipe exit": {
|
/*LANG*/"Swipe exit": {
|
||||||
value: settings.swipeExit == true,
|
value: settings.swipeExit == true,
|
||||||
onchange: m => { save("swipeExit", m) }
|
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]);
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
E.showMenu(appMenu);
|
E.showMenu(appMenu);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue