mirror of https://github.com/espruino/BangleApps
Merge pull request #2771 from bobrippling/popcon-reset
popcon: add reset ability and don't advertise as a launcherpull/2783/head
commit
7d04e3852f
|
@ -1,3 +1,4 @@
|
|||
0.01: New App!
|
||||
0.02: Trim old entries from the popcon app cache
|
||||
0.03: Avoid polluting global scope
|
||||
0.04: Add settings app for resetting popcon
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
trimCache(cache);
|
||||
require("Storage").writeJSON("popcon.cache.json", cache);
|
||||
if (orderChanged) {
|
||||
var info = oldRead("popcon.info", true);
|
||||
var info = oldRead("popconlaunch.info", true);
|
||||
info.cacheBuster = !info.cacheBuster;
|
||||
require("Storage").writeJSON("popcon.info", info);
|
||||
require("Storage").writeJSON("popconlaunch.info", info);
|
||||
}
|
||||
};
|
||||
var sortCache = function () {
|
||||
|
|
|
@ -38,9 +38,9 @@ const saveCache = (cache: Cache, orderChanged: boolean) => {
|
|||
require("Storage").writeJSON("popcon.cache.json", cache);
|
||||
if(orderChanged){
|
||||
// ensure launchers reload their caches:
|
||||
const info: AppInfo & { cacheBuster?: boolean } = oldRead("popcon.info", true);
|
||||
const info: AppInfo & { cacheBuster?: boolean } = oldRead("popconlaunch.info", true);
|
||||
info.cacheBuster = !info.cacheBuster;
|
||||
require("Storage").writeJSON("popcon.info", info);
|
||||
require("Storage").writeJSON("popconlaunch.info", info);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -2,16 +2,17 @@
|
|||
"id": "popconlaunch",
|
||||
"name": "Popcon Launcher",
|
||||
"shortName": "Popcon",
|
||||
"version": "0.03",
|
||||
"version": "0.04",
|
||||
"description": "Launcher modification - your launchers will display your favourite (popular) apps first. Overrides `readJSON`, may slow down your watch",
|
||||
"readme": "README.md",
|
||||
"icon": "app.png",
|
||||
"type": "bootloader",
|
||||
"tags": "tool,system,launcher",
|
||||
"tags": "tool,system",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"storage": [
|
||||
{"name":"popcon.boot.js","url":"boot.js"},
|
||||
{"name":"popcon.img","url":"icon.js","evaluate":true}
|
||||
{"name":"popcon.img","url":"icon.js","evaluate":true},
|
||||
{"name":"popcon.settings.js","url":"settings.js"}
|
||||
],
|
||||
"data": [
|
||||
{"name":"popcon.cache.json"}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
(function (back) {
|
||||
var menu = {
|
||||
'': { 'title': 'Popcon' },
|
||||
'< Back': back,
|
||||
'Reset app popularities': function () {
|
||||
var S = require("Storage");
|
||||
S.erase("popcon.cache.json");
|
||||
var info = S.readJSON("popconlaunch.info", true);
|
||||
info.cacheBuster = !info.cacheBuster;
|
||||
S.writeJSON("popconlaunch.info", info);
|
||||
E.showMessage("Popcon reset", "Done");
|
||||
},
|
||||
};
|
||||
E.showMenu(menu);
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
(function(back) {
|
||||
const menu = {
|
||||
'': {'title': 'Popcon'},
|
||||
'< Back': back,
|
||||
'Reset app popularities': () => {
|
||||
const S = require("Storage");
|
||||
S.erase("popcon.cache.json");
|
||||
|
||||
const info: AppInfo & { cacheBuster?: boolean } = S.readJSON("popconlaunch.info", true);
|
||||
info.cacheBuster = !info.cacheBuster;
|
||||
S.writeJSON("popconlaunch.info", info);
|
||||
|
||||
E.showMessage("Popcon reset", "Done");
|
||||
},
|
||||
};
|
||||
|
||||
E.showMenu(menu);
|
||||
}) satisfies SettingsFunc
|
Loading…
Reference in New Issue