Tap menu items without a service tag will be ignored.

The JSON schema checker is relied on to highlight this error.
This commit is contained in:
Philip Abbey
2023-11-17 17:51:01 +00:00
parent 6b8892aee8
commit 4b320086ee
4 changed files with 10 additions and 10 deletions

View File

@ -138,7 +138,7 @@ class HomeAssistantApp extends Application.AppBase {
function fetchMenuConfig() as Void { function fetchMenuConfig() as Void {
var options = { var options = {
:method => Communications.HTTP_REQUEST_METHOD_GET, :method => Communications.HTTP_REQUEST_METHOD_GET,
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
}; };
Communications.makeWebRequest( Communications.makeWebRequest(

View File

@ -32,11 +32,11 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
hidden var mService as Lang.String; hidden var mService as Lang.String;
function initialize( function initialize(
label as Lang.String or Lang.Symbol, label as Lang.String or Lang.Symbol,
subLabel as Lang.String or Lang.Symbol or Null, subLabel as Lang.String or Lang.Symbol or Null,
identifier as Lang.Object or Null, identifier as Lang.Object or Null,
service as Lang.String or Null, service as Lang.String or Null,
options as { options as {
:alignment as WatchUi.MenuItem.Alignment, :alignment as WatchUi.MenuItem.Alignment,
:icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol :icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol
} or Null } or Null

View File

@ -31,16 +31,16 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
hidden var strUnhandledHttpErr as Lang.String; hidden var strUnhandledHttpErr as Lang.String;
function initialize( function initialize(
label as Lang.String or Lang.Symbol, label as Lang.String or Lang.Symbol,
subLabel as Lang.String or Lang.Symbol or { subLabel as Lang.String or Lang.Symbol or {
:enabled as Lang.String or Lang.Symbol or Null, :enabled as Lang.String or Lang.Symbol or Null,
:disabled as Lang.String or Lang.Symbol or Null :disabled as Lang.String or Lang.Symbol or Null
} or Null, } or Null,
identifier, identifier,
enabled as Lang.Boolean, enabled as Lang.Boolean,
options as { options as {
:alignment as WatchUi.MenuItem.Alignment, :alignment as WatchUi.MenuItem.Alignment,
:icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol :icon as Graphics.BitmapType or WatchUi.Drawable or Lang.Symbol
} or Null } or Null
) { ) {
strNoInternet = WatchUi.loadResource($.Rez.Strings.NoInternet); strNoInternet = WatchUi.loadResource($.Rez.Strings.NoInternet);

View File

@ -68,7 +68,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
); );
addItem(item); addItem(item);
mListToggleItems.add(item); mListToggleItems.add(item);
} else if (type.equals("tap")) { } else if (type.equals("tap") && service != null) {
addItem( addItem(
new HomeAssistantMenuItem( new HomeAssistantMenuItem(
name, name,