Skip to content

Commit 2c3ca42

Browse files
author
thyttan
committed
Merge branch 'app-history-from-fastload-utils' into app-loader
2 parents 3ece90b + 675a007 commit 2c3ca42

File tree

6 files changed

+3
-57
lines changed

6 files changed

+3
-57
lines changed

apps/apphist/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"supports": ["BANGLEJS2"],
99
"readme": "README.md",
1010
"storage": [
11-
{"name":"apphist.5.boot.js","url":"boot.js"},
11+
{"name":"apphist.6.boot.js","url":"boot.js"},
1212
{"name":"apphist.settings.js","url":"settings.js"}
1313
],
1414
"data": [{"name":"apphist.json"}]

apps/fastload/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
0.04: (WIP) Allow use of app history when going back (`load()` or `Bangle.load()` calls without specified app).
55
0.05: Check for changes in setting.js and force real reload if needed
66
0.06: Fix caching whether an app is fastloadable
7+
0.07: Break out app history to a separate app: App History, `apphist`.

apps/fastload/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,10 @@ Bangle will just end up with a memory leak or undefined behaviour**
1818

1919
## Settings
2020

21-
* Activate app history and navigate back through recent apps instead of immediately loading the clock face
22-
* If Quick Launch is installed it can be excluded from app history
2321
* Allows to redirect all loads usually loading the clock to the launcher instead
2422
* The "Fastloading..." screen can be switched off
2523
* Enable checking `setting.json` and force a complete load on changes
2624

27-
## App history
28-
29-
* Long press of hardware button clears the app history and loads the clock face
30-
* Installing the 'Fast Reset' app allows doing fastloads directly to the clock face by pressing the hardware button just a little longer than a click. Useful if there are many apps in the history and the user want to access the clock quickly.
31-
3225
## Technical Notes
3326

3427
Fastload uses the same mechanism as `.bootcde` does to check the app to be loaded for widget use and stores the result of that and a hash of the js in a cache.

apps/fastload/boot.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,8 @@ let fastload = function(n){
6060
};
6161
global.load = fastload;
6262

63-
let appHistory, resetHistory, recordHistory;
64-
if (SETTINGS.useAppHistory){
65-
appHistory = s.readJSON("fastload.history.json",true)||[];
66-
resetHistory = ()=>{appHistory=[];s.writeJSON("fastload.history.json",appHistory);};
67-
recordHistory = ()=>{s.writeJSON("fastload.history.json",appHistory);};
68-
}
69-
7063
Bangle.load = (o => (name) => {
7164
if (Bangle.uiRemove && !SETTINGS.hideLoading) loadingScreen();
72-
if (SETTINGS.useAppHistory){
73-
if (name && name!=".bootcde" && !(name=="quicklaunch.app.js" && SETTINGS.disregardQuicklaunch)) {
74-
// store the name of the app to launch
75-
appHistory.push(name);
76-
} else if (name==".bootcde") { // when Bangle.showClock is called
77-
resetHistory();
78-
} else if (name=="quicklaunch.app.js" && SETTINGS.disregardQuicklaunch) {
79-
// do nothing with history
80-
} else {
81-
// go back in history
82-
appHistory.pop();
83-
name = appHistory[appHistory.length-1];
84-
}
85-
}
8665
if (SETTINGS.autoloadLauncher && !name){
8766
let orig = Bangle.load;
8867
Bangle.load = (n)=>{
@@ -94,6 +73,4 @@ Bangle.load = (o => (name) => {
9473
} else
9574
o(name);
9675
})(Bangle.load);
97-
98-
if (SETTINGS.useAppHistory) E.on('kill', ()=>{if (!BTN.read()) recordHistory(); else resetHistory();}); // Usually record history, but reset it if long press of HW button was used.
9976
}

apps/fastload/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ "id": "fastload",
22
"name": "Fastload Utils",
33
"shortName" : "Fastload Utils",
4-
"version": "0.06",
4+
"version": "0.07",
55
"icon": "icon.png",
66
"description": "Enable experimental fastloading for more apps. ⚠️ Use with extreme caution - many apps are not compatible with fastload and will cause memory leaks and instability.",
77
"type":"bootloader",

apps/fastload/settings.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
(function(back) {
22
var FILE="fastload.json";
33
var settings;
4-
var isQuicklaunchPresent = !!require('Storage').read("quicklaunch.app.js", 0, 1);
54

65
function writeSettings(key, value) {
76
var s = require('Storage').readJSON(FILE, true) || {};
@@ -21,34 +20,10 @@
2120

2221
mainmenu[''] = { 'title': 'Fastload', back: back };
2322

24-
mainmenu['Activate app history'] = {
25-
value: !!settings.useAppHistory,
26-
onchange: v => {
27-
writeSettings("useAppHistory",v);
28-
if (v && settings.autoloadLauncher) {
29-
writeSettings("autoloadLauncher",!v); // Don't use app history and load to launcher together.
30-
setTimeout(()=>E.showMenu(buildMainMenu()), 0); // Update the menu so it can be seen if a value was automatically set to false (app history vs load launcher).
31-
}
32-
}
33-
};
34-
35-
if (isQuicklaunchPresent) {
36-
mainmenu['Exclude Quick Launch from history'] = {
37-
value: !!settings.disregardQuicklaunch,
38-
onchange: v => {
39-
writeSettings("disregardQuicklaunch",v);
40-
}
41-
};
42-
}
43-
4423
mainmenu['Force load to launcher'] = {
4524
value: !!settings.autoloadLauncher,
4625
onchange: v => {
4726
writeSettings("autoloadLauncher",v);
48-
if (v && settings.useAppHistory) {
49-
writeSettings("useAppHistory",!v);
50-
setTimeout(()=>E.showMenu(buildMainMenu()), 0); // Update the menu so it can be seen if a value was automatically set to false (app history vs load launcher).
51-
} // Don't use app history and load to launcher together.
5227
}
5328
};
5429

0 commit comments

Comments
 (0)