2 fixes as required by issue 185

Solution to a race condition with starting updates and amendment to error message presentation on Webhook ID creation failure.

Co-Authored-By: Joseph Abbey <me@josephabbey.dev>
This commit is contained in:
Philip Abbey
2024-09-07 20:27:58 +01:00
parent 060cd2729f
commit a48ab486ae
2 changed files with 44 additions and 30 deletions

View File

@ -181,8 +181,12 @@ class WebhookManager {
// 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.unsetIsSensorsLevelEnabled();
// ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + data.toString());
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String);
if (data == null) {
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\nNull data");
} else {
// All objects have toString()
ErrorView.show(WatchUi.loadResource($.Rez.Strings.WebhookFailed) as Lang.String + "\n" + data.toString());
}
}
break;