GarminHomeAssistant/source/HomeAssistantViewMenuItem.mc
Philip Abbey ce90d9d47f Single HomeAssistantService for all Taps
1. Amended code for a single HomeAssistantService for all 'tap's
2. Removed now redundant GET request for taps without a service now that having a service is enforced.
3. Determined that migrating API code from 'toggle's to the HomeAssistantService is awkward due to the close coupling with other methods in the class.
2023-11-20 21:32:35 +00:00

44 lines
1.4 KiB
MonkeyC

//-----------------------------------------------------------------------------------
//
// Distributed under MIT Licence
// See https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/LICENSE.
//
//-----------------------------------------------------------------------------------
//
// GarminHomeAssistant is a Garmin IQ application written in Monkey C and routinely
// tested on a Venu 2 device. The source code is provided at:
// https://github.com/house-of-abbey/GarminHomeAssistant.
//
// P A Abbey & J D Abbey, 31 October 2023
//
//
// Description:
//
// Menu button that opens a sub-menu.
//
//-----------------------------------------------------------------------------------
using Toybox.Lang;
using Toybox.WatchUi;
class HomeAssistantViewMenuItem extends WatchUi.MenuItem {
private var mMenu as HomeAssistantView;
function initialize(definition as Lang.Dictionary) {
// definitions.get(...) are Strings here as they have been checked by HomeAssistantView first
WatchUi.MenuItem.initialize(
definition.get("name") as Lang.String,
WatchUi.loadResource($.Rez.Strings.MenuItemMenu) as Lang.String,
definition.get("entity") as Lang.String,
null
);
mMenu = new HomeAssistantView(definition, null);
}
function getMenuView() as HomeAssistantView {
return mMenu;
}
}