Added option to turn off automatic menu update checking

This is because it uses additional memory than can cause some older devices to crash unless they have smaller menus.
This commit is contained in:
Philip Abbey
2025-09-13 11:06:29 +01:00
parent e284cd2d4a
commit 7ba0d76bf6
45 changed files with 180 additions and 31 deletions

View File

@@ -35,6 +35,7 @@ class Settings {
private static var mConfigUrl as Lang.String = "";
private static var mCacheConfig as Lang.Boolean = false;
private static var mClearCache as Lang.Boolean = false;
private static var mMenuCheck as Lang.Boolean = false;
private static var mVibrate as Lang.Boolean = false;
private static var mWifiLteExecution as Lang.Boolean = false;
//! seconds
@@ -68,6 +69,7 @@ class Settings {
mConfigUrl = Properties.getValue("config_url");
mCacheConfig = Properties.getValue("cache_config");
mClearCache = Properties.getValue("clear_cache");
mMenuCheck = Properties.getValue("enable_menu_update_check");
mWifiLteExecution = Properties.getValue("wifi_lte_execution");
mVibrate = Properties.getValue("enable_vibration");
mAppTimeout = Properties.getValue("app_timeout");
@@ -80,6 +82,16 @@ class Settings {
mUserHeaderName = Properties.getValue("user_http_header_name");
mUserHeaderValue = Properties.getValue("user_http_header_value");
mClearWebhookId = Properties.getValue("clear_webhook_id");
if (mIsApp && mMenuCheck && !mCacheConfig) {
unsetMenuCheck();
// Tell the user
if (WatchUi has :showToast) {
WatchUi.showToast(WatchUi.loadResource($.Rez.Strings.MenuCheckDisabled) as Lang.String, null);
//} else {
// NB. Cannot show an Alert() here.
}
}
}
//! A webhook is required for non-privileged API calls.
@@ -225,6 +237,24 @@ class Settings {
Properties.setValue("clear_cache", mClearCache);
}
//! Get the menu check Boolean option supplied as part of the Settings.
//!
//! @return Boolean for whether the menu should be checked for updates when
//! the application is started, and the cache updated ready for the
//! next time the application is restarted.
//
static function getMenuCheck() as Lang.Boolean {
return mMenuCheck;
}
//! Unset the menu check Boolean option supplied as part of the Settings. This
//! option should only be set when the menu definition is cached too.
//
static function unsetMenuCheck() {
mMenuCheck = false;
Properties.setValue("enable_menu_update_check", mMenuCheck);
}
//! Get the value of the Wi-Fi/LTE toggle in settings.
//!
//! @return The state of the toggle.