Update HomeAssistantApp.mc

Found a bug when our Dynamic DNS went down. Can't update no menu items.
This commit is contained in:
Philip Abbey
2023-12-24 12:43:34 +00:00
parent bb26e0048f
commit 2ed8e9a3df

View File

@ -38,7 +38,7 @@ class HomeAssistantApp extends Application.AppBase {
private var strTrailingSlashErr as Lang.String or Null;
private var strAvailable = WatchUi.loadResource($.Rez.Strings.Available);
private var strUnavailable = WatchUi.loadResource($.Rez.Strings.Unavailable);
private var strUnconfigured = WatchUi.loadResource($.Rez.Strings.Unconfigured);
private var strUnconfigured = WatchUi.loadResource($.Rez.Strings.Unconfigured);
private var mApiKey as Lang.String or Null; // The compiler can't tell these are updated by
private var mApiUrl as Lang.String or Null; // initialize(), hence the "or Null".
@ -441,8 +441,17 @@ class HomeAssistantApp extends Application.AppBase {
// This function is called by a timer every Globals.menuItemUpdateInterval ms.
function updateNextMenuItem() as Void {
var itu = mItemsToUpdate as Lang.Array<HomeAssistantToggleMenuItem>;
itu[mNextItemToUpdate].getState();
mNextItemToUpdate = (mNextItemToUpdate + 1) % itu.size();
if (itu == null) {
if (Globals.scDebug) {
System.println("HomeAssistantApp updateNextMenuItem(): No menu items to update");
}
if (!mIsGlance) {
ErrorView.show(WatchUi.loadResource($.Rez.Strings.ConfigUrlNotFound));
}
} else {
itu[mNextItemToUpdate].getState();
mNextItemToUpdate = (mNextItemToUpdate + 1) % itu.size();
}
}
function getQuitTimer() as QuitTimer {