mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
notification: fix action invoke when animations are disabled
This commit is contained in:
@@ -402,9 +402,7 @@ Variants {
|
||||
return a.identifier === "default";
|
||||
});
|
||||
if (hasDefault) {
|
||||
card.animateOut();
|
||||
deferredActionTimer.actionId = "default";
|
||||
deferredActionTimer.start();
|
||||
card.runDeferredAction("default", false);
|
||||
}
|
||||
}
|
||||
onCanceled: {
|
||||
@@ -493,6 +491,25 @@ Variants {
|
||||
}
|
||||
}
|
||||
|
||||
function runDeferredAction(actionId, isHistoryRemoval) {
|
||||
if (Style.animationSlow <= 0) {
|
||||
if (isHistoryRemoval) {
|
||||
NotificationService.removeFromHistory(notificationId);
|
||||
} else {
|
||||
NotificationService.invokeAction(notificationId, actionId);
|
||||
}
|
||||
card.animateOut();
|
||||
return;
|
||||
}
|
||||
|
||||
deferredActionTimer.stop();
|
||||
deferredActionTimer.actionId = actionId || "";
|
||||
deferredActionTimer.isHistoryRemoval = isHistoryRemoval;
|
||||
deferredActionTimer.interval = Math.min(50, Math.max(1, Style.animationSlow - 1));
|
||||
card.animateOut();
|
||||
deferredActionTimer.start();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: removalTimer
|
||||
interval: Style.animationSlow
|
||||
@@ -699,10 +716,7 @@ Variants {
|
||||
outlined: false
|
||||
implicitHeight: 24
|
||||
onClicked: {
|
||||
card.animateOut();
|
||||
deferredActionTimer.actionId = actionData.identifier;
|
||||
deferredActionTimer.isHistoryRemoval = false;
|
||||
deferredActionTimer.start();
|
||||
card.runDeferredAction(actionData.identifier, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,9 +737,7 @@ Variants {
|
||||
anchors.rightMargin: Style.marginM
|
||||
|
||||
onClicked: {
|
||||
card.animateOut();
|
||||
deferredActionTimer.isHistoryRemoval = true;
|
||||
deferredActionTimer.start();
|
||||
card.runDeferredAction("", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user