mirror of https://github.com/espruino/BangleApps
popcon: initial launch-sortorder modification app
parent
df50a4dd7b
commit
d4878be7fa
|
@ -0,0 +1 @@
|
|||
0.01: New App!
|
|
@ -0,0 +1,9 @@
|
|||
Popcon
|
||||
======
|
||||
|
||||
Display apps sorted by regular use.
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
- `Show Clocks` - Whether clocks are shown in the app list. Default `Yes`.
|
Binary file not shown.
After Width: | Height: | Size: 899 B |
|
@ -0,0 +1,43 @@
|
|||
// TODO: fastload
|
||||
const oldRead = require("Storage").readJSON;
|
||||
let cache;
|
||||
|
||||
const ensureCache = () => {
|
||||
if(!cache){
|
||||
cache = oldRead("popcon.cache.json", 1);
|
||||
if(!cache)
|
||||
cache = {};
|
||||
}
|
||||
};
|
||||
|
||||
const saveCache = () => {
|
||||
require("Storage").writeJSON("popcon.cache.json", cache);
|
||||
};
|
||||
|
||||
const sortCache = () => {
|
||||
// TODO
|
||||
};
|
||||
|
||||
require("Storage").readJSON = (fname, skipExceptions) => {
|
||||
const j = oldRead(fname, skipExceptions);
|
||||
|
||||
if(fname.test(/\.info$/)){
|
||||
ensureCache();
|
||||
|
||||
if(j.src && cache[j.src]?.sortorder)
|
||||
j.sortorder = cache[j.src].sortorder;
|
||||
}
|
||||
|
||||
return j;
|
||||
} satisfies typeof oldRead;
|
||||
|
||||
const oldLoad = load;
|
||||
load = (src) => {
|
||||
ensureCache();
|
||||
cache[src].pop++;
|
||||
cache[src].last = Date.now();
|
||||
sortCache();
|
||||
saveCache();
|
||||
|
||||
return oldLoad(src);
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"id": "popconlaunch",
|
||||
"name": "Popcon Launcher",
|
||||
"shortName": "Popcon",
|
||||
"version": "0.01",
|
||||
"description": "Launcher displaying your favourite (popular) apps first",
|
||||
"readme": "README.md",
|
||||
"icon": "TODO_app.png",
|
||||
"type": "launch",
|
||||
"tags": "tool,system,launcher",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"storage": [
|
||||
{"name":"popcon.boot.js","url":"boot.js"}
|
||||
],
|
||||
"data": [
|
||||
{"name":"popcon.cache.json"}
|
||||
],
|
||||
"sortorder": -10
|
||||
}
|
Loading…
Reference in New Issue