Rename variable

This commit is contained in:
Joseph Abbey
2025-08-15 13:56:46 +01:00
parent 04dec1a8ba
commit 25cbcfe59a
2 changed files with 19 additions and 19 deletions

View File

@@ -119,7 +119,7 @@ class Settings {
} else { } else {
// Explicitly disable the background event which persists when the application closes. // Explicitly disable the background event which persists when the application closes.
// If !mHasService disable the Settings option as user feedback // If !mHasService disable the Settings option as user feedback
unsetIsSensorsLevelEnabled(); unsetIsSensorsEnabled();
unsetWebhookId(); unsetWebhookId();
} }
} }
@@ -280,13 +280,13 @@ class Settings {
//! //!
//! @return Boolean for whether logging of the watch sensors is enabled. //! @return Boolean for whether logging of the watch sensors is enabled.
// //
static function isSensorsLevelEnabled() as Lang.Boolean { static function IsSensorsEnabled() as Lang.Boolean {
return mIsSensorsEnabled; return mIsSensorsEnabled;
} }
//! Disable logging of the watch's sensors. //! Disable logging of the watch's sensors.
// //
static function unsetIsSensorsLevelEnabled() { static function unsetIsSensorsEnabled() {
mIsSensorsEnabled = false; mIsSensorsEnabled = false;
Properties.setValue("enable_battery_level", mIsSensorsEnabled); Properties.setValue("enable_battery_level", mIsSensorsEnabled);
if (mHasService and (Background.getTemporalEventRegisteredTime() != null)) { if (mHasService and (Background.getTemporalEventRegisteredTime() != null)) {

View File

@@ -61,13 +61,13 @@ class WebhookManager {
break; break;
case Communications.INVALID_HTTP_BODY_IN_NETWORK_RESPONSE: case Communications.INVALID_HTTP_BODY_IN_NETWORK_RESPONSE:
// System.println("WebhookManager onReturnRequestWebhookId() Response Code: INVALID_HTTP_BODY_IN_NETWORK_RESPONSE, check JSON is returned."); // System.println("WebhookManager onReturnRequestWebhookId() Response Code: INVALID_HTTP_BODY_IN_NETWORK_RESPONSE, check JSON is returned.");
Settings.unsetIsSensorsLevelEnabled(); Settings.unsetIsSensorsEnabled();
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.NoJson) as Lang.String); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.NoJson) as Lang.String);
break; break;
case 404: case 404:
// System.println("WebhookManager onReturnRequestWebhookId() Response Code: 404, page not found. Check API URL setting."); // System.println("WebhookManager onReturnRequestWebhookId() Response Code: 404, page not found. Check API URL setting.");
Settings.unsetIsSensorsLevelEnabled(); Settings.unsetIsSensorsEnabled();
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.ApiUrlNotFound) as Lang.String); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.ApiUrlNotFound) as Lang.String);
break; break;
@@ -80,14 +80,14 @@ class WebhookManager {
registerWebhookSensors(); registerWebhookSensors();
} else { } else {
// System.println("WebhookManager onReturnRequestWebhookId(): No webhook id in response data."); // System.println("WebhookManager onReturnRequestWebhookId(): No webhook id in response data.");
Settings.unsetIsSensorsLevelEnabled(); Settings.unsetIsSensorsEnabled();
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "."); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + ".");
} }
break; break;
default: default:
// System.println("WebhookManager onReturnRequestWebhookId(): Unhandled HTTP response code = " + responseCode); // System.println("WebhookManager onReturnRequestWebhookId(): Unhandled HTTP response code = " + responseCode);
Settings.unsetIsSensorsLevelEnabled(); Settings.unsetIsSensorsEnabled();
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.UnhandledHttpErr) as Lang.String + responseCode); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.UnhandledHttpErr) as Lang.String + responseCode);
} }
} }
@@ -186,7 +186,7 @@ class WebhookManager {
} else { } else {
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Failure, no 'success'."); // System.println("WebhookManager onReturnRegisterWebhookSensor(): Failure, no 'success'.");
Settings.unsetWebhookId(); Settings.unsetWebhookId();
Settings.unsetIsSensorsLevelEnabled(); Settings.unsetIsSensorsEnabled();
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "."); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + ".");
} }
} else { } else {
@@ -194,7 +194,7 @@ class WebhookManager {
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Failure, not a Lang.Dict"); // System.println("WebhookManager onReturnRegisterWebhookSensor(): Failure, not a Lang.Dict");
// Webhook ID might have been deleted on Home Assistant server and a Lang.String is trying to tell us an error message // Webhook ID might have been deleted on Home Assistant server and a Lang.String is trying to tell us an error message
Settings.unsetWebhookId(); Settings.unsetWebhookId();
Settings.unsetIsSensorsLevelEnabled(); Settings.unsetIsSensorsEnabled();
if (data == null) { if (data == null) {
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\nNull data"); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\nNull data");
} else { } else {
@@ -207,7 +207,7 @@ class WebhookManager {
default: default:
// System.println("WebhookManager onReturnRequestWebhookId(): Unhandled HTTP response code = " + responseCode); // System.println("WebhookManager onReturnRequestWebhookId(): Unhandled HTTP response code = " + responseCode);
Settings.unsetWebhookId(); Settings.unsetWebhookId();
Settings.unsetIsSensorsLevelEnabled(); Settings.unsetIsSensorsEnabled();
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.UnhandledHttpErr) as Lang.String + " " + responseCode); ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + WatchUi.loadResource($.Rez.Strings.UnhandledHttpErr) as Lang.String + " " + responseCode);
} }
} }
@@ -253,7 +253,7 @@ class WebhookManager {
"unit_of_measurement" => "%", "unit_of_measurement" => "%",
"state_class" => "measurement", "state_class" => "measurement",
"entity_category" => "diagnostic", "entity_category" => "diagnostic",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}, },
{ {
"device_class" => "battery_charging", "device_class" => "battery_charging",
@@ -263,7 +263,7 @@ class WebhookManager {
"unique_id" => "battery_is_charging", "unique_id" => "battery_is_charging",
"icon" => System.getSystemStats().charging ? "mdi:battery-plus" : "mdi:battery-minus", "icon" => System.getSystemStats().charging ? "mdi:battery-plus" : "mdi:battery-minus",
"entity_category" => "diagnostic", "entity_category" => "diagnostic",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}, },
{ {
"name" => "Heart rate", "name" => "Heart rate",
@@ -273,7 +273,7 @@ class WebhookManager {
"icon" => "mdi:heart-pulse", "icon" => "mdi:heart-pulse",
"unit_of_measurement" => "bpm", "unit_of_measurement" => "bpm",
"state_class" => "measurement", "state_class" => "measurement",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
} }
]; ];
@@ -287,7 +287,7 @@ class WebhookManager {
"unique_id" => "steps_today", "unique_id" => "steps_today",
"icon" => "mdi:walk", "icon" => "mdi:walk",
"state_class" => "total", "state_class" => "total",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}); });
if (ActivityMonitor.Info has :floorsClimbed) { if (ActivityMonitor.Info has :floorsClimbed) {
@@ -298,7 +298,7 @@ class WebhookManager {
"unique_id" => "floors_climbed_today", "unique_id" => "floors_climbed_today",
"icon" => "mdi:stairs-up", "icon" => "mdi:stairs-up",
"state_class" => "total", "state_class" => "total",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}); });
} }
@@ -310,7 +310,7 @@ class WebhookManager {
"unique_id" => "floors_descended_today", "unique_id" => "floors_descended_today",
"icon" => "mdi:stairs-down", "icon" => "mdi:stairs-down",
"state_class" => "total", "state_class" => "total",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}); });
} }
@@ -323,7 +323,7 @@ class WebhookManager {
"icon" => "mdi:lungs", "icon" => "mdi:lungs",
"unit_of_measurement" => "bpm", "unit_of_measurement" => "bpm",
"state_class" => "measurement", "state_class" => "measurement",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}); });
} }
} else { } else {
@@ -347,14 +347,14 @@ class WebhookManager {
"state" => activity, "state" => activity,
"type" => "sensor", "type" => "sensor",
"unique_id" => "activity", "unique_id" => "activity",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}); });
mSensors.add({ mSensors.add({
"name" => "Sub-activity", "name" => "Sub-activity",
"state" => sub_activity, "state" => sub_activity,
"type" => "sensor", "type" => "sensor",
"unique_id" => "sub_activity", "unique_id" => "sub_activity",
"disabled" => !Settings.isSensorsLevelEnabled() "disabled" => !Settings.IsSensorsEnabled()
}); });
} }