lockscreen: Trigger QuickActionButton action after time finished instead of onRelease

Currently, we wait user release the button to trigger action. It makes more sense to trigger directly when the timer is triggered.

I keep buttonHeld variable for animation.
This commit is contained in:
Florian RICHER 2025-06-21 13:49:30 +02:00 committed by Devin Lin
parent 0512e1f3a2
commit 19e07982dc

View file

@ -94,10 +94,7 @@ AbstractButton {
} }
} }
onReleased: { function triggerButtonAction() {
if (!buttonHeld) {
return
}
switch (buttonAction) { switch (buttonAction) {
case ShellSettings.Settings.Flashlight: case ShellSettings.Settings.Flashlight:
FlashlightUtil.toggleTorch(); FlashlightUtil.toggleTorch();
@ -116,6 +113,7 @@ AbstractButton {
onTriggered: { onTriggered: {
haptics.buttonVibrate(); haptics.buttonVibrate();
buttonHeld = true; buttonHeld = true;
triggerButtonAction();
} }
} }