Merge pull request #2771 from bobrippling/popcon-reset

popcon: add reset ability and don't advertise as a launcher
pull/2783/head
Gordon Williams 2023-05-24 10:15:57 +01:00 committed by GitHub
commit 7d04e3852f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 7 deletions

View File

@ -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

View File

@ -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 () {

View File

@ -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);
}
};

View File

@ -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"}

View File

@ -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);
});

View File

@ -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