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:
@@ -133,6 +133,8 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else if (type.equals("numeric") && action != null) {
|
} else if (type.equals("numeric") && action != null) {
|
||||||
|
if (System.getDeviceSettings().isTouchScreen) {
|
||||||
|
// Numeric items are only actionable on touch screen devices.
|
||||||
if (tap_action != null) {
|
if (tap_action != null) {
|
||||||
var picker = tap_action.get("picker") as Lang.Dictionary?;
|
var picker = tap_action.get("picker") as Lang.Dictionary?;
|
||||||
if (picker != null) {
|
if (picker != null) {
|
||||||
@@ -151,6 +153,20 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} 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.
|
||||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||||
|
|||||||
Reference in New Issue
Block a user