timers as statics, defensive popviews, no double confirmation, add pin

screen onBack, toggle state tweaks
This commit is contained in:
Vincent Elger Zwanenburg
2025-07-19 00:38:38 +01:00
parent be7eed1ae1
commit db3fbd9886
6 changed files with 150 additions and 59 deletions

View File

@ -244,6 +244,11 @@ class HomeAssistantPinConfirmationDelegate extends WatchUi.BehaviorDelegate {
mTimer.stop();
}
WatchUi.popView(WatchUi.SLIDE_RIGHT);
// Set the toggle, if we have one
if (mToggleMethod != null) {
mToggleMethod.invoke(!mState);
}
mConfirmMethod.invoke(mState);
} else {
error();
@ -285,10 +290,7 @@ class HomeAssistantPinConfirmationDelegate extends WatchUi.BehaviorDelegate {
if (mTimer != null) {
mTimer.stop();
}
// Undo the toggle, if we have one
if (mToggleMethod != null) {
mToggleMethod.invoke(!mState);
}
WatchUi.popView(WatchUi.SLIDE_RIGHT);
}
@ -314,6 +316,13 @@ class HomeAssistantPinConfirmationDelegate extends WatchUi.BehaviorDelegate {
goBack();
}
//! Handle the back button (ESC)
//
function onBack() as Lang.Boolean {
goBack();
return true;
}
}