Merge pull request #2905 from halemmerich/fastload
fastload - Check for changes in setting.json and force real reload if neededmaster
commit
61a3b406af
|
|
@ -2,3 +2,4 @@
|
||||||
0.02: Allow redirection of loads to the launcher
|
0.02: Allow redirection of loads to the launcher
|
||||||
0.03: Allow hiding the fastloading info screen
|
0.03: Allow hiding the fastloading info screen
|
||||||
0.04: (WIP) Allow use of app history when going back (`load()` or `Bangle.load()` calls without specified app).
|
0.04: (WIP) Allow use of app history when going back (`load()` or `Bangle.load()` calls without specified app).
|
||||||
|
0.05: Check for changes in setting.js and force real reload if needed
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ This allows fast loading of all apps with two conditions:
|
||||||
* If Quick Launch is installed it can be excluded from app history
|
* If Quick Launch is installed it can be excluded from app history
|
||||||
* Allows to redirect all loads usually loading the clock to the launcher instead
|
* Allows to redirect all loads usually loading the clock to the launcher instead
|
||||||
* The "Fastloading..." screen can be switched off
|
* The "Fastloading..." screen can be switched off
|
||||||
|
* Enable checking `setting.json` and force a complete load on changes
|
||||||
|
|
||||||
## App history
|
## App history
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,23 @@ let loadingScreen = function(){
|
||||||
|
|
||||||
let cache = s.readJSON("fastload.cache") || {};
|
let cache = s.readJSON("fastload.cache") || {};
|
||||||
|
|
||||||
let checkApp = function(n){
|
const SYS_SETTINGS="setting.json";
|
||||||
|
|
||||||
|
let appFastloadPossible = function(n){
|
||||||
|
if(SETTINGS.detectSettingsChange && (!cache[SYS_SETTINGS] || s.hash(SYS_SETTINGS) != cache[SYS_SETTINGS])){
|
||||||
|
cache[SYS_SETTINGS] = s.hash(SYS_SETTINGS);
|
||||||
|
s.writeJSON("fastload.cache", cache);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// no widgets, no problem
|
// no widgets, no problem
|
||||||
if (!global.WIDGETS) return true;
|
if (!global.WIDGETS) return true;
|
||||||
let app = s.read(n);
|
let app = s.read(n);
|
||||||
if (cache[n] && E.CRC32(app) == cache[n].crc)
|
if (cache[n] && s.hash(app) == cache[n].hash)
|
||||||
return cache[n].fast;
|
return cache[n].fast;
|
||||||
cache[n] = {};
|
cache[n] = {};
|
||||||
cache[n].fast = app.includes("Bangle.loadWidgets");
|
cache[n].fast = app.includes("Bangle.loadWidgets");
|
||||||
cache[n].crc = E.CRC32(app);
|
cache[n].hash = s.hash(app);
|
||||||
s.writeJSON("fastload.cache", cache);
|
s.writeJSON("fastload.cache", cache);
|
||||||
return cache[n].fast;
|
return cache[n].fast;
|
||||||
};
|
};
|
||||||
|
|
@ -39,7 +47,7 @@ let slowload = function(n){
|
||||||
};
|
};
|
||||||
|
|
||||||
let fastload = function(n){
|
let fastload = function(n){
|
||||||
if (!n || checkApp(n)){
|
if (!n || appFastloadPossible(n)){
|
||||||
// Bangle.load can call load, to prevent recursion this must be the system load
|
// Bangle.load can call load, to prevent recursion this must be the system load
|
||||||
global.load = slowload;
|
global.load = slowload;
|
||||||
Bangle.load(n);
|
Bangle.load(n);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ "id": "fastload",
|
{ "id": "fastload",
|
||||||
"name": "Fastload Utils",
|
"name": "Fastload Utils",
|
||||||
"shortName" : "Fastload Utils",
|
"shortName" : "Fastload Utils",
|
||||||
"version": "0.04",
|
"version": "0.05",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"description": "Enable experimental fastloading for more apps",
|
"description": "Enable experimental fastloading for more apps",
|
||||||
"type":"bootloader",
|
"type":"bootloader",
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,13 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mainmenu['Detect settings changes'] = {
|
||||||
|
value: !!settings.detectSettingsChange,
|
||||||
|
onchange: v => {
|
||||||
|
writeSettings("detectSettingsChange",v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return mainmenu;
|
return mainmenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue