From 143bcf08a7e162fcd3f6e000005d315948c6b813 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sun, 10 Dec 2023 22:52:09 +0100 Subject: [PATCH] Add application property "confirm_timeout" After this time (in seconds), a confirmation dialog for an action is automatically closed and the action is cancelled. Set to 0 to disable the timeout. The default value is 3 seconds. --- resources/settings/properties.xml | 6 ++++++ resources/settings/settings.xml | 10 ++++++++++ source/HomeAssistantConfirmation.mc | 12 +++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/resources/settings/properties.xml b/resources/settings/properties.xml index b640dfa..102efc1 100644 --- a/resources/settings/properties.xml +++ b/resources/settings/properties.xml @@ -30,6 +30,12 @@ --> 0 + + 3 + diff --git a/resources/settings/settings.xml b/resources/settings/settings.xml index 6f10416..638194d 100644 --- a/resources/settings/settings.xml +++ b/resources/settings/settings.xml @@ -53,6 +53,16 @@ /> + + + + 0) { + timeout = new Timer.Timer(); + timeout.start(method(:onTimeout), timeoutSeconds * 1000, true); + } } function onResponse(response) as Lang.Boolean { getApp().getQuitTimer().reset(); - timeout.stop(); + if (timeout) { + timeout.stop(); + } if (response == WatchUi.CONFIRM_YES) { confirmMethod.invoke(); }