mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2026-06-26 14:03:28 +00:00
Non-touch screens cannot use PIN
When a menu item requests a PIN on devices without a touch screen, replace the menu item with an info item displaying a message for the user.
This commit is contained in:
@@ -112,7 +112,7 @@ class HomeAssistantMenuItemFactory {
|
|||||||
label as Lang.String or Lang.Symbol,
|
label as Lang.String or Lang.Symbol,
|
||||||
entity_id as Lang.String?,
|
entity_id as Lang.String?,
|
||||||
template as Lang.String?,
|
template as Lang.String?,
|
||||||
action as Lang.String?,
|
action as Lang.String?,
|
||||||
data as Lang.Dictionary?,
|
data as Lang.Dictionary?,
|
||||||
options as {
|
options as {
|
||||||
:exit as Lang.Boolean,
|
:exit as Lang.Boolean,
|
||||||
|
|||||||
@@ -133,23 +133,39 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else if (type.equals("numeric") && action != null) {
|
} else if (type.equals("numeric") && action != null) {
|
||||||
if (tap_action != null) {
|
if (System.getDeviceSettings().isTouchScreen) {
|
||||||
var picker = tap_action.get("picker") as Lang.Dictionary?;
|
// Numeric items are only actionable on touch screen devices.
|
||||||
if (picker != null) {
|
if (tap_action != null) {
|
||||||
addItem(HomeAssistantMenuItemFactory.create().numeric(
|
var picker = tap_action.get("picker") as Lang.Dictionary?;
|
||||||
name,
|
if (picker != null) {
|
||||||
entity,
|
addItem(HomeAssistantMenuItemFactory.create().numeric(
|
||||||
content,
|
name,
|
||||||
action,
|
entity,
|
||||||
data,
|
content,
|
||||||
picker,
|
action,
|
||||||
{
|
data,
|
||||||
:exit => exit,
|
picker,
|
||||||
:confirm => confirm,
|
{
|
||||||
:pin => pin
|
:exit => exit,
|
||||||
}
|
:confirm => confirm,
|
||||||
));
|
:pin => pin
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||||
|
"PIN requires Touchscreen",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
:exit => false,
|
||||||
|
:confirm => false,
|
||||||
|
:pin => false
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
} else if (type.equals("info") && content != null) {
|
} else if (type.equals("info") && content != null) {
|
||||||
// Cannot exit from a non-actionable information only menu item.
|
// Cannot exit from a non-actionable information only menu item.
|
||||||
|
|||||||
Reference in New Issue
Block a user