commit
7830fb60c5
|
|
@ -9,3 +9,4 @@
|
||||||
0.07: Convert Yes/No On/Off in settings to checkboxes
|
0.07: Convert Yes/No On/Off in settings to checkboxes
|
||||||
0.08: Fix the wrapping of intervals/timeouts with parameters
|
0.08: Fix the wrapping of intervals/timeouts with parameters
|
||||||
Fix the widget drawing if widgets are hidden and Bangle.setLCDBrightness is called
|
Fix the widget drawing if widgets are hidden and Bangle.setLCDBrightness is called
|
||||||
|
0.09: Cache the app-launch info
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "powermanager",
|
"id": "powermanager",
|
||||||
"name": "Power Manager",
|
"name": "Power Manager",
|
||||||
"shortName": "Power Manager",
|
"shortName": "Power Manager",
|
||||||
"version": "0.08",
|
"version": "0.09",
|
||||||
"description": "Allow configuration of warnings and thresholds for battery charging and display.",
|
"description": "Allow configuration of warnings and thresholds for battery charging and display.",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "bootloader",
|
"type": "bootloader",
|
||||||
|
|
|
||||||
|
|
@ -9,27 +9,38 @@ var blankImage = Graphics.createImage(` `);
|
||||||
var rowHeight = g.getHeight()/3;
|
var rowHeight = g.getHeight()/3;
|
||||||
|
|
||||||
// Load apps list
|
// Load apps list
|
||||||
var apps = Storage.list(/\.info$/).map(app=>{
|
var apps;
|
||||||
var a=Storage.readJSON(app,1);
|
|
||||||
return a&&{
|
var launchCache = s.readJSON("launch.cache.json", true)||{};
|
||||||
name:a.name,
|
var launchHash = require("Storage").hash(/\.info/);
|
||||||
type:a.type,
|
if (launchCache.hash==launchHash) {
|
||||||
icon:a.icon ? Storage.read(a.icon) : a.icon,
|
apps = launchCache.apps;
|
||||||
sortorder:a.sortorder,
|
} else {
|
||||||
src:a.src
|
apps = Storage.list(/\.info$/).map(app=>{
|
||||||
};
|
var a=Storage.readJSON(app,1);
|
||||||
}).filter(app=>app && (
|
return a&&{
|
||||||
app.type=="app"
|
name:a.name,
|
||||||
// || (app.type=="clock" && settings.showClocks)
|
type:a.type,
|
||||||
|| !app.type
|
icon:a.icon ? Storage.read(a.icon) : a.icon,
|
||||||
));
|
sortorder:a.sortorder,
|
||||||
apps.sort((a,b)=>{
|
src:a.src
|
||||||
var n=(0|a.sortorder)-(0|b.sortorder);
|
};
|
||||||
if (n) return n; // do sortorder first
|
}).filter(app=>app && (
|
||||||
if (a.name<b.name) return -1;
|
app.type=="app"
|
||||||
if (a.name>b.name) return 1;
|
// || (app.type=="clock" && settings.showClocks)
|
||||||
return 0;
|
|| !app.type
|
||||||
});
|
));
|
||||||
|
apps.sort((a,b)=>{
|
||||||
|
var n=(0|a.sortorder)-(0|b.sortorder);
|
||||||
|
if (n) return n; // do sortorder first
|
||||||
|
if (a.name<b.name) return -1;
|
||||||
|
if (a.name>b.name) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
launchCache = { apps, hash: launchHash };
|
||||||
|
s.writeJSON("launch.cache.json", launchCache);
|
||||||
|
}
|
||||||
|
|
||||||
// Uncomment for testing in the emulator without apps:
|
// Uncomment for testing in the emulator without apps:
|
||||||
// apps = [
|
// apps = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue