From 0128df01fc0c56295848a446e92b4af16fd15f3c Mon Sep 17 00:00:00 2001 From: d3nd3 Date: Tue, 4 Jul 2023 20:40:45 +0100 Subject: [PATCH] New option 'FastLoad into Widget-less' keep widgets in RAM but hide them. --- apps/fastload/ChangeLog | 1 + apps/fastload/README.md | 2 ++ apps/fastload/boot.js | 11 ++++++++++- apps/fastload/metadata.json | 2 +- apps/fastload/settings.js | 15 +++++++++++---- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/apps/fastload/ChangeLog b/apps/fastload/ChangeLog index 4e68ab2c71b..071f368ea3e 100644 --- a/apps/fastload/ChangeLog +++ b/apps/fastload/ChangeLog @@ -2,3 +2,4 @@ 0.02: Allow redirection of loads to the launcher 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.05: New option 'FastLoad into Widget-less' keep widgets in RAM but hide them. diff --git a/apps/fastload/README.md b/apps/fastload/README.md index be4175f55f5..60fa2835809 100644 --- a/apps/fastload/README.md +++ b/apps/fastload/README.md @@ -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 * Allows to redirect all loads usually loading the clock to the launcher instead * The "Fastloading..." screen can be switched off +* FastLoad into Widget-less uses widget_utils to hide widgets but remain in RAM. ## App history @@ -29,3 +30,4 @@ It checks the app to be loaded for widget use and stores the result of that and # Contributors [thyttan](https://github.com/thyttan) +[d3nd3](https://github.com/d3nd3) diff --git a/apps/fastload/boot.js b/apps/fastload/boot.js index c7fc2fd8625..68dd16a27e0 100644 --- a/apps/fastload/boot.js +++ b/apps/fastload/boot.js @@ -39,12 +39,21 @@ let slowload = function(n){ }; let fastload = function(n){ - if (!n || checkApp(n)){ + let force = SETTINGS.force; + let checked = n ? checkApp(n) : true; + if (force || !n || checkApp(n)){ // Bangle.load can call load, to prevent recursion this must be the system load global.load = slowload; + if (force && n === ".bootcde") n = "" // hide that we direct call clock. Bangle.load(n); + //its loaded because above line would had reset mem otherwise. + global.__FILE__ = n; // restore // if fastloading worked, we need to set load back to this method global.load = fastload; + if (force) { + if (checked) require("widget_utils").show(); + else require("widget_utils").hide(); + } } else slowload(n); diff --git a/apps/fastload/metadata.json b/apps/fastload/metadata.json index 954a7d8b44a..abd5b3ed597 100644 --- a/apps/fastload/metadata.json +++ b/apps/fastload/metadata.json @@ -1,7 +1,7 @@ { "id": "fastload", "name": "Fastload Utils", "shortName" : "Fastload Utils", - "version": "0.04", + "version": "0.05", "icon": "icon.png", "description": "Enable experimental fastloading for more apps", "type":"bootloader", diff --git a/apps/fastload/settings.js b/apps/fastload/settings.js index 66c990df1fd..1c89e7c3195 100644 --- a/apps/fastload/settings.js +++ b/apps/fastload/settings.js @@ -30,7 +30,7 @@ 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'] = { @@ -50,15 +50,22 @@ 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. } - }; + }; mainmenu['Hide "Fastloading..."'] = { value: !!settings.hideLoading, onchange: v => { writeSettings("hideLoading",v); } - }; - + + }; + + mainmenu['FastLoad into Widget-less'] = { + value: !!settings.force, + onchange: v => { + writeSettings("force",v); + } + }; return mainmenu; }