Merge pull request #3789 from thyttan/dtlaunch

dtlaunch: fix caching preventing settings taking effect and use own chache file
master
thyttan 2025-04-06 02:02:45 +02:00 committed by GitHub
commit 1d568b5785
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 5 deletions

View File

@ -32,3 +32,7 @@ when moving pages. Add caching for faster startups.
0.25: Minor code improvements
0.26: Bangle 2: Postpone loading icons that are not needed initially.
0.27: Bangle 2: Add setting to remember and present the last open page between instances of dtlaunch.
0.28: Bangle 2: Fix showClocks and showLaunchers settings not taking effect by
clearing cache when changing those settings.
Bangle 2: Use a separate cache file from the standard launcher.
Bangle 2: Don't leave cache file after uninstalling the app.

View File

@ -16,14 +16,14 @@
let s = require("Storage");
// Borrowed caching from Icon Launcher, code by halemmerich.
let launchCache = s.readJSON("launch.cache.json", true)||{};
let launchCache = s.readJSON("dtlaunch.cache.json", true)||{};
let launchHash = require("Storage").hash(/\.info/);
if (launchCache.hash!=launchHash) {
launchCache = {
hash : launchHash,
apps : s.list(/\.info$/)
.map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};})
.filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type))
.filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || (app.type=="launch" && settings.showLaunchers) || !app.type))
.sort((a,b)=>{
var n=(0|a.sortorder)-(0|b.sortorder);
if (n) return n; // do sortorder first
@ -31,7 +31,7 @@
if (a.name>b.name) return 1;
return 0;
}) };
s.writeJSON("launch.cache.json", launchCache);
s.writeJSON("dtlaunch.cache.json", launchCache);
}
let apps = launchCache.apps;
let page = 0;

View File

@ -1,7 +1,7 @@
{
"id": "dtlaunch",
"name": "Desktop Launcher",
"version": "0.27",
"version": "0.28",
"description": "Desktop style App Launcher with six (four for Bangle 2) apps per page - fast access if you have lots of apps installed.",
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
"icon": "icon.png",
@ -16,5 +16,8 @@
{"name":"dtlaunch.settings.js","url":"settings-b2.js", "supports": ["BANGLEJS2"]},
{"name":"dtlaunch.img","url":"app-icon.js","evaluate":true}
],
"data": [{"name":"dtlaunch.json"}]
"data": [
{"name":"dtlaunch.json"},
{"name":"dtlaunch.cache.json"}
]
}

View File

@ -17,6 +17,10 @@
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
function clearCache() {
require("Storage").erase("dtlaunch.cache.json")
}
E.showMenu({
"" : { "title" : "Desktop launcher" },
/*LANG*/"< Back" : () => back(),
@ -25,6 +29,7 @@
onchange: v => {
settings.showClocks = v;
writeSettings();
clearCache();
}
},
/*LANG*/'Show launchers': {
@ -32,6 +37,7 @@
onchange: v => {
settings.showLaunchers = v;
writeSettings();
clearCache();
}
},
/*LANG*/'Direct launch': {