Deprecate template type

This commit is contained in:
Joseph Abbey
2024-08-30 13:25:16 +01:00
parent df3be94bf9
commit 1c182dd615
5 changed files with 50 additions and 179 deletions

View File

@ -79,55 +79,13 @@ class HomeAssistantMenuItemFactory {
);
}
function template_tap(
function tap(
label as Lang.String or Lang.Symbol,
entity as Lang.String or Null,
template as Lang.String or Null,
service as Lang.String or Null,
confirm as Lang.Boolean,
data as Lang.Dictionary or Null
) as WatchUi.MenuItem {
if (entity != null) {
if (data == null) {
data = { "entity_id" => entity };
} else {
data.put("entity_id", entity);
}
}
return new HomeAssistantTemplateMenuItem(
label,
template,
service,
confirm,
data,
mTapTypeIcon,
mMenuItemOptions,
mHomeAssistantService
);
}
function template_notap(
label as Lang.String or Lang.Symbol,
template as Lang.String or Null
) as WatchUi.MenuItem {
return new HomeAssistantTemplateMenuItem(
label,
template,
null,
false,
null,
mInfoTypeIcon,
mMenuItemOptions,
mHomeAssistantService
);
}
function tap(
label as Lang.String or Lang.Symbol,
entity as Lang.String or Null,
service as Lang.String or Null,
confirm as Lang.Boolean,
data as Lang.Dictionary or Null
) as WatchUi.MenuItem {
if (entity != null) {
if (data == null) {
@ -138,6 +96,7 @@ class HomeAssistantMenuItemFactory {
}
return new HomeAssistantTapMenuItem(
label,
template,
service,
confirm,
data,