Merge pull request #3789 from thyttan/dtlaunch
dtlaunch: fix caching preventing settings taking effect and use own chache filemaster
commit
1d568b5785
|
|
@ -32,3 +32,7 @@ when moving pages. Add caching for faster startups.
|
||||||
0.25: Minor code improvements
|
0.25: Minor code improvements
|
||||||
0.26: Bangle 2: Postpone loading icons that are not needed initially.
|
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.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.
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
let s = require("Storage");
|
let s = require("Storage");
|
||||||
// Borrowed caching from Icon Launcher, code by halemmerich.
|
// 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/);
|
let launchHash = require("Storage").hash(/\.info/);
|
||||||
if (launchCache.hash!=launchHash) {
|
if (launchCache.hash!=launchHash) {
|
||||||
launchCache = {
|
launchCache = {
|
||||||
hash : launchHash,
|
hash : launchHash,
|
||||||
apps : s.list(/\.info$/)
|
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};})
|
.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)=>{
|
.sort((a,b)=>{
|
||||||
var n=(0|a.sortorder)-(0|b.sortorder);
|
var n=(0|a.sortorder)-(0|b.sortorder);
|
||||||
if (n) return n; // do sortorder first
|
if (n) return n; // do sortorder first
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
if (a.name>b.name) return 1;
|
if (a.name>b.name) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}) };
|
}) };
|
||||||
s.writeJSON("launch.cache.json", launchCache);
|
s.writeJSON("dtlaunch.cache.json", launchCache);
|
||||||
}
|
}
|
||||||
let apps = launchCache.apps;
|
let apps = launchCache.apps;
|
||||||
let page = 0;
|
let page = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "dtlaunch",
|
"id": "dtlaunch",
|
||||||
"name": "Desktop Launcher",
|
"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.",
|
"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"}],
|
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
|
|
@ -16,5 +16,8 @@
|
||||||
{"name":"dtlaunch.settings.js","url":"settings-b2.js", "supports": ["BANGLEJS2"]},
|
{"name":"dtlaunch.settings.js","url":"settings-b2.js", "supports": ["BANGLEJS2"]},
|
||||||
{"name":"dtlaunch.img","url":"app-icon.js","evaluate":true}
|
{"name":"dtlaunch.img","url":"app-icon.js","evaluate":true}
|
||||||
],
|
],
|
||||||
"data": [{"name":"dtlaunch.json"}]
|
"data": [
|
||||||
|
{"name":"dtlaunch.json"},
|
||||||
|
{"name":"dtlaunch.cache.json"}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@
|
||||||
|
|
||||||
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
|
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
|
||||||
|
|
||||||
|
function clearCache() {
|
||||||
|
require("Storage").erase("dtlaunch.cache.json")
|
||||||
|
}
|
||||||
|
|
||||||
E.showMenu({
|
E.showMenu({
|
||||||
"" : { "title" : "Desktop launcher" },
|
"" : { "title" : "Desktop launcher" },
|
||||||
/*LANG*/"< Back" : () => back(),
|
/*LANG*/"< Back" : () => back(),
|
||||||
|
|
@ -25,6 +29,7 @@
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.showClocks = v;
|
settings.showClocks = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
|
clearCache();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*LANG*/'Show launchers': {
|
/*LANG*/'Show launchers': {
|
||||||
|
|
@ -32,6 +37,7 @@
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.showLaunchers = v;
|
settings.showLaunchers = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
|
clearCache();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*LANG*/'Direct launch': {
|
/*LANG*/'Direct launch': {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue