BangleApps/apps/fastload/settings.js

74 lines
2.2 KiB
JavaScript
Raw Permalink Normal View History

(function(back) {
var FILE="fastload.json";
var settings;
fastload: Add app history functionality Add app history functionality add semicolons that were missing according to Web IDE fix intendtation in if statement fewer storage manipulations, tweak some logic comment regarding resetting history undo `const SETTINGS` -> `let settings` describe app history in readme In settings, don't allow app history and load to launcher to be active at the same time change `launchedApps` -> `appHistory` (somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected add to comment re loading `.bootcde` an extra time on init Revert "add to comment re loading `.bootcde` an extra time on init" This reverts commit b4aaccf35c820a1c7e7a22040c3958b4fc92e5c6. Revert "(somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected" This reverts commit 51dddfc30ac65572891efee1daf6099f7a3b19f4. tweak when settings page is autoupdated Change description for app history. Add contributor. quicklaunch shall not be recorded in the history Add setting to exclude quicklaunch from history, if it is present remove print statements If long press HW button do reset history. Set some variables to null if app history is disabled. add info re long press HW button resets history remove check for 'fastload.5.boot.js'. it would show up in the app history during development because the web ide said to load the uploaded app. it should not be needed in normal operations of the app for users. fewer checks for if useAppHistory is true, by first declaring some variables and then defining them inside an if-statement add recommendation of 'Fast Reset' app in readme
2023-03-25 12:56:53 +00:00
var isQuicklaunchPresent = !!require('Storage').read("quicklaunch.app.js", 0, 1);
function writeSettings(key, value) {
var s = require('Storage').readJSON(FILE, true) || {};
s[key] = value;
require('Storage').writeJSON(FILE, s);
readSettings();
}
function readSettings(){
settings = require('Storage').readJSON(FILE, true) || {};
}
fastload: Add app history functionality Add app history functionality add semicolons that were missing according to Web IDE fix intendtation in if statement fewer storage manipulations, tweak some logic comment regarding resetting history undo `const SETTINGS` -> `let settings` describe app history in readme In settings, don't allow app history and load to launcher to be active at the same time change `launchedApps` -> `appHistory` (somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected add to comment re loading `.bootcde` an extra time on init Revert "add to comment re loading `.bootcde` an extra time on init" This reverts commit b4aaccf35c820a1c7e7a22040c3958b4fc92e5c6. Revert "(somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected" This reverts commit 51dddfc30ac65572891efee1daf6099f7a3b19f4. tweak when settings page is autoupdated Change description for app history. Add contributor. quicklaunch shall not be recorded in the history Add setting to exclude quicklaunch from history, if it is present remove print statements If long press HW button do reset history. Set some variables to null if app history is disabled. add info re long press HW button resets history remove check for 'fastload.5.boot.js'. it would show up in the app history during development because the web ide said to load the uploaded app. it should not be needed in normal operations of the app for users. fewer checks for if useAppHistory is true, by first declaring some variables and then defining them inside an if-statement add recommendation of 'Fast Reset' app in readme
2023-03-25 12:56:53 +00:00
readSettings();
function buildMainMenu(){
fastload: Add app history functionality Add app history functionality add semicolons that were missing according to Web IDE fix intendtation in if statement fewer storage manipulations, tweak some logic comment regarding resetting history undo `const SETTINGS` -> `let settings` describe app history in readme In settings, don't allow app history and load to launcher to be active at the same time change `launchedApps` -> `appHistory` (somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected add to comment re loading `.bootcde` an extra time on init Revert "add to comment re loading `.bootcde` an extra time on init" This reverts commit b4aaccf35c820a1c7e7a22040c3958b4fc92e5c6. Revert "(somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected" This reverts commit 51dddfc30ac65572891efee1daf6099f7a3b19f4. tweak when settings page is autoupdated Change description for app history. Add contributor. quicklaunch shall not be recorded in the history Add setting to exclude quicklaunch from history, if it is present remove print statements If long press HW button do reset history. Set some variables to null if app history is disabled. add info re long press HW button resets history remove check for 'fastload.5.boot.js'. it would show up in the app history during development because the web ide said to load the uploaded app. it should not be needed in normal operations of the app for users. fewer checks for if useAppHistory is true, by first declaring some variables and then defining them inside an if-statement add recommendation of 'Fast Reset' app in readme
2023-03-25 12:56:53 +00:00
var mainmenu = {};
mainmenu[''] = { 'title': 'Fastload', back: back };
mainmenu['Activate app history'] = {
value: !!settings.useAppHistory,
onchange: v => {
writeSettings("useAppHistory",v);
if (v && settings.autoloadLauncher) {
writeSettings("autoloadLauncher",!v); // Don't use app history and load to launcher together.
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).
}
}
};
if (isQuicklaunchPresent) {
mainmenu['Exclude Quick Launch from history'] = {
value: !!settings.disregardQuicklaunch,
onchange: v => {
writeSettings("disregardQuicklaunch",v);
}
};
}
mainmenu['Force load to launcher'] = {
value: !!settings.autoloadLauncher,
onchange: v => {
writeSettings("autoloadLauncher",v);
fastload: Add app history functionality Add app history functionality add semicolons that were missing according to Web IDE fix intendtation in if statement fewer storage manipulations, tweak some logic comment regarding resetting history undo `const SETTINGS` -> `let settings` describe app history in readme In settings, don't allow app history and load to launcher to be active at the same time change `launchedApps` -> `appHistory` (somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected add to comment re loading `.bootcde` an extra time on init Revert "add to comment re loading `.bootcde` an extra time on init" This reverts commit b4aaccf35c820a1c7e7a22040c3958b4fc92e5c6. Revert "(somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected" This reverts commit 51dddfc30ac65572891efee1daf6099f7a3b19f4. tweak when settings page is autoupdated Change description for app history. Add contributor. quicklaunch shall not be recorded in the history Add setting to exclude quicklaunch from history, if it is present remove print statements If long press HW button do reset history. Set some variables to null if app history is disabled. add info re long press HW button resets history remove check for 'fastload.5.boot.js'. it would show up in the app history during development because the web ide said to load the uploaded app. it should not be needed in normal operations of the app for users. fewer checks for if useAppHistory is true, by first declaring some variables and then defining them inside an if-statement add recommendation of 'Fast Reset' app in readme
2023-03-25 12:56:53 +00:00
if (v && settings.useAppHistory) {
writeSettings("useAppHistory",!v);
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).
} // Don't use app history and load to launcher together.
}
fastload: Add app history functionality Add app history functionality add semicolons that were missing according to Web IDE fix intendtation in if statement fewer storage manipulations, tweak some logic comment regarding resetting history undo `const SETTINGS` -> `let settings` describe app history in readme In settings, don't allow app history and load to launcher to be active at the same time change `launchedApps` -> `appHistory` (somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected add to comment re loading `.bootcde` an extra time on init Revert "add to comment re loading `.bootcde` an extra time on init" This reverts commit b4aaccf35c820a1c7e7a22040c3958b4fc92e5c6. Revert "(somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected" This reverts commit 51dddfc30ac65572891efee1daf6099f7a3b19f4. tweak when settings page is autoupdated Change description for app history. Add contributor. quicklaunch shall not be recorded in the history Add setting to exclude quicklaunch from history, if it is present remove print statements If long press HW button do reset history. Set some variables to null if app history is disabled. add info re long press HW button resets history remove check for 'fastload.5.boot.js'. it would show up in the app history during development because the web ide said to load the uploaded app. it should not be needed in normal operations of the app for users. fewer checks for if useAppHistory is true, by first declaring some variables and then defining them inside an if-statement add recommendation of 'Fast Reset' app in readme
2023-03-25 12:56:53 +00:00
};
mainmenu['Hide "Fastloading..."'] = {
value: !!settings.hideLoading,
onchange: v => {
writeSettings("hideLoading",v);
}
};
mainmenu['Detect settings changes'] = {
value: !!settings.detectSettingsChange,
onchange: v => {
writeSettings("detectSettingsChange",v);
}
};
fastload: Add app history functionality Add app history functionality add semicolons that were missing according to Web IDE fix intendtation in if statement fewer storage manipulations, tweak some logic comment regarding resetting history undo `const SETTINGS` -> `let settings` describe app history in readme In settings, don't allow app history and load to launcher to be active at the same time change `launchedApps` -> `appHistory` (somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected add to comment re loading `.bootcde` an extra time on init Revert "add to comment re loading `.bootcde` an extra time on init" This reverts commit b4aaccf35c820a1c7e7a22040c3958b4fc92e5c6. Revert "(somewhat unstable commit) tweaking logic around loading `.bootcde` at system initiation to make the history and resetting of history work as expected" This reverts commit 51dddfc30ac65572891efee1daf6099f7a3b19f4. tweak when settings page is autoupdated Change description for app history. Add contributor. quicklaunch shall not be recorded in the history Add setting to exclude quicklaunch from history, if it is present remove print statements If long press HW button do reset history. Set some variables to null if app history is disabled. add info re long press HW button resets history remove check for 'fastload.5.boot.js'. it would show up in the app history during development because the web ide said to load the uploaded app. it should not be needed in normal operations of the app for users. fewer checks for if useAppHistory is true, by first declaring some variables and then defining them inside an if-statement add recommendation of 'Fast Reset' app in readme
2023-03-25 12:56:53 +00:00
return mainmenu;
}
E.showMenu(buildMainMenu());
})