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:
Philip Abbey
2026-06-24 00:17:26 +01:00
parent a97440b997
commit 8c5bdbc1f8
2 changed files with 33 additions and 17 deletions

View File

@@ -133,6 +133,8 @@ class HomeAssistantView extends WatchUi.Menu2 {
));
}
} else if (type.equals("numeric") && action != null) {
if (System.getDeviceSettings().isTouchScreen) {
// Numeric items are only actionable on touch screen devices.
if (tap_action != null) {
var picker = tap_action.get("picker") as Lang.Dictionary?;
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) {
// Cannot exit from a non-actionable information only menu item.
addItem(HomeAssistantMenuItemFactory.create().tap(