Added error message when insecure HTTP menu fetch returns SECURE_CONNECTION_REQUIRED

This commit is contained in:
Philip Abbey
2026-07-28 20:26:25 +01:00
parent e912c96734
commit e38301ef1a
3 changed files with 24 additions and 1 deletions

View File

@@ -30,12 +30,13 @@
<string id="NoAPIKey" scope="glance">No API key in the application settings.</string>
<string id="NoApiUrl" scope="glance">No API URL in the application settings.</string>
<string id="NoConfigUrl" scope="glance">No configuration URL in the application settings.</string>
<string id="NoHTTPS">No response, use secure HTTPS connection.</string>
<string id="NoInternet">No Internet connection.</string>
<string id="NoJson">No JSON returned from HTTP request.</string>
<string id="NoMenu">Menu definition error, check the instructions.</string>
<string id="NoPhone" scope="glance">No Phone connection.</string>
<string id="NoPhoneNoCache" scope="glance">No phone connection, no cached menu.</string>
<string id="NoResponse">No Response, check Internet connection</string>
<string id="NoResponse">No Response, check secure HTTPS connection</string>
<string id="TimedOut">Request timed out</string>
<string id="PinInputLocked">PIN input locked for</string>
<string id="PotentialError">Potential Error</string>

View File

@@ -195,6 +195,13 @@ class HomeAssistantApp extends Application.AppBase {
}
break;
case Communications.SECURE_CONNECTION_REQUIRED:
// System.println("HomeAssistantApp onReturnFetchMenuConfig() Response Code: SECURE_CONNECTION_REQUIRED, check API URL setting.");
if (mIsApp) {
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoHTTPS) as Lang.String);
}
break;
case 404:
// System.println("HomeAssistantApp onReturnFetchMenuConfig() Response Code: 404, page not found. Check Configuration URL setting.");
if (mIsApp) {
@@ -508,6 +515,13 @@ class HomeAssistantApp extends Application.AppBase {
myTimer.start(method(:updateMenuItems), Globals.scApiBackoffMs, false);
break;
case Communications.SECURE_CONNECTION_REQUIRED:
// System.println("HomeAssistantApp onReturnFetchMenuConfig() Response Code: SECURE_CONNECTION_REQUIRED, check API URL setting.");
if (mIsApp) {
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoHTTPS) as Lang.String);
}
break;
case 404:
// System.println("HomeAssistantApp onReturnCheckMenuConfig() Response Code: 404, page not found. Check API URL setting.");
ErrorView.show(WatchUi.loadResource($.Rez.Strings.ApiUrlNotFound) as Lang.String);
@@ -798,6 +812,13 @@ class HomeAssistantApp extends Application.AppBase {
}
break;
case Communications.SECURE_CONNECTION_REQUIRED:
// System.println("HomeAssistantApp onReturnFetchMenuConfig() Response Code: SECURE_CONNECTION_REQUIRED, check API URL setting.");
if (mIsApp) {
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoHTTPS) as Lang.String);
}
break;
case 404:
// System.println("HomeAssistantApp onReturnFetchApiStatus() Response Code: 404, page not found. Check Configuration URL setting.");
if (mIsApp) {

View File

@@ -59,6 +59,7 @@ class WebhookManager {
// System.println("WebhookManager onReturnRequestWebhookId() Response Code: NETWORK_RESPONSE_OUT_OF_MEMORY, are we going too fast?");
// Ignore and see if we can carry on
break;
case Communications.INVALID_HTTP_BODY_IN_NETWORK_RESPONSE:
// System.println("WebhookManager onReturnRequestWebhookId() Response Code: INVALID_HTTP_BODY_IN_NETWORK_RESPONSE, check JSON is returned.");
Settings.unsetIsSensorsEnabled();