mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2026-08-12 16:11:23 +00:00
Big fix for PIN enabled items on non-touchscreen devices
This commit is contained in:
@@ -59,4 +59,5 @@
|
|||||||
| 3.11 | <img src="images/Venu2_glance_default.png" width="200" title="Default Glance"/><br/>Better handling of menus larger than the Glance view can handle. As a result the Glance can no longer verify the availability of the JSON menu as fetching it might cause an _"Error: Out Of Memory Error"_. Provide two user supplied HTTP Headers. Bug fix for the numeric picker. |
|
| 3.11 | <img src="images/Venu2_glance_default.png" width="200" title="Default Glance"/><br/>Better handling of menus larger than the Glance view can handle. As a result the Glance can no longer verify the availability of the JSON menu as fetching it might cause an _"Error: Out Of Memory Error"_. Provide two user supplied HTTP Headers. Bug fix for the numeric picker. |
|
||||||
| 3.12 | Amended GPS accuracy values used by the background service. |
|
| 3.12 | Amended GPS accuracy values used by the background service. |
|
||||||
| 3.13 | Added support for new devices: `d2mach2pro`, `fr170`, `fr170m`, `fr70`. |
|
| 3.13 | Added support for new devices: `d2mach2pro`, `fr170`, `fr170m`, `fr70`. |
|
||||||
| 3.14 | Numeric items now support `tap_action.data` fields so service call options like `transition` are catered for. See the documentation on [Additional Action Data](https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/examples/Numeric.md#additional-action-data). This features has been provided by [@StumblingGamer](https://github.com/StumblingGamer). Now prevent PIN enabled menu items from being enabled on non-touch screen devices. The PIN must be removed for the menu item to function. Fix for initialising numeric pickers with no user defined template. |
|
| 3.14 | Numeric items now support `tap_action.data` fields so service call options like `transition` are catered for. See the documentation on [Additional Action Data](https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/examples/Numeric.md#additional-action-data). This features has been provided by [@StumblingGamer](https://github.com/StumblingGamer). Now prevent PIN enabled menu items from being enabled on non-touch screen devices. The PIN must be removed for the menu item to function. Fix for initialising numeric pickers with no user defined template. |
|
||||||
|
| 3.15 | The prevention of PIN enabled menu items on non-touch screen devices was improperly implemented, this version provides a bug fix. |
|
||||||
|
|||||||
@@ -76,49 +76,32 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type != null && name != null && enabled) {
|
if (type != null && name != null && enabled) {
|
||||||
if (type.equals("toggle") && entity != null) {
|
if (pin && !System.getDeviceSettings().isTouchScreen) {
|
||||||
addItem(HomeAssistantMenuItemFactory.create().toggle(
|
|
||||||
name,
|
|
||||||
entity,
|
|
||||||
content,
|
|
||||||
{
|
|
||||||
:exit => exit,
|
|
||||||
:confirm => confirm,
|
|
||||||
:pin => pin
|
|
||||||
}
|
|
||||||
));
|
|
||||||
} else if (type.equals("tap") && action != null) {
|
|
||||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||||
name,
|
"PIN requires Touchscreen",
|
||||||
entity,
|
null,
|
||||||
content,
|
null,
|
||||||
action,
|
null,
|
||||||
data,
|
data,
|
||||||
{
|
{
|
||||||
:exit => exit,
|
:exit => false,
|
||||||
:confirm => confirm,
|
:confirm => false,
|
||||||
:pin => pin
|
:pin => false
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
} else if (type.equals("template") && content != null) {
|
} else {
|
||||||
// NB. "template" is deprecated in the schema and remains only for backward compatibility. All menu items can now use templates, so the replacement is "info".
|
if (type.equals("toggle") && entity != null) {
|
||||||
// The exit option is dependent on the type of template.
|
addItem(HomeAssistantMenuItemFactory.create().toggle(
|
||||||
if (tap_action == null) {
|
|
||||||
// No exit from an information only item
|
|
||||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
|
||||||
name,
|
name,
|
||||||
entity,
|
entity,
|
||||||
content,
|
content,
|
||||||
action,
|
|
||||||
data,
|
|
||||||
{
|
{
|
||||||
:exit => false,
|
:exit => exit,
|
||||||
:confirm => confirm,
|
:confirm => confirm,
|
||||||
:pin => pin
|
:pin => pin
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
} else {
|
} else if (type.equals("tap") && action != null) {
|
||||||
// You may exit from template item with a 'tap_action'.
|
|
||||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||||
name,
|
name,
|
||||||
entity,
|
entity,
|
||||||
@@ -131,9 +114,39 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
:pin => pin
|
:pin => pin
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
} else if (type.equals("template") && content != null) {
|
||||||
} else if (type.equals("numeric") && action != null) {
|
// NB. "template" is deprecated in the schema and remains only for backward compatibility. All menu items can now use templates, so the replacement is "info".
|
||||||
if (System.getDeviceSettings().isTouchScreen) {
|
// The exit option is dependent on the type of template.
|
||||||
|
if (tap_action == null) {
|
||||||
|
// No exit from an information only item
|
||||||
|
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||||
|
name,
|
||||||
|
entity,
|
||||||
|
content,
|
||||||
|
action,
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
:exit => false,
|
||||||
|
:confirm => confirm,
|
||||||
|
:pin => pin
|
||||||
|
}
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
// You may exit from template item with a 'tap_action'.
|
||||||
|
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||||
|
name,
|
||||||
|
entity,
|
||||||
|
content,
|
||||||
|
action,
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
:exit => exit,
|
||||||
|
:confirm => confirm,
|
||||||
|
:pin => pin
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} else if (type.equals("numeric") && action != null) {
|
||||||
// Numeric items are only actionable on touch screen devices.
|
// 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?;
|
||||||
@@ -153,36 +166,23 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (type.equals("info") && content != null) {
|
||||||
|
// Cannot exit from a non-actionable information only menu item.
|
||||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||||
"PIN requires Touchscreen",
|
name,
|
||||||
null,
|
entity,
|
||||||
null,
|
content,
|
||||||
null,
|
action,
|
||||||
data,
|
data,
|
||||||
{
|
{
|
||||||
:exit => false,
|
:exit => false,
|
||||||
:confirm => false,
|
:confirm => confirm,
|
||||||
:pin => false
|
:pin => pin
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
} else if (type.equals("group")) {
|
||||||
|
addItem(HomeAssistantMenuItemFactory.create().group(items[i], content));
|
||||||
}
|
}
|
||||||
} else if (type.equals("info") && content != null) {
|
|
||||||
// Cannot exit from a non-actionable information only menu item.
|
|
||||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
|
||||||
name,
|
|
||||||
entity,
|
|
||||||
content,
|
|
||||||
action,
|
|
||||||
data,
|
|
||||||
{
|
|
||||||
:exit => false,
|
|
||||||
:confirm => confirm,
|
|
||||||
:pin => pin
|
|
||||||
}
|
|
||||||
));
|
|
||||||
} else if (type.equals("group")) {
|
|
||||||
addItem(HomeAssistantMenuItemFactory.create().group(items[i], content));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user