mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-29 22:47:47 -04:00
notifications: add invokeLast ipc to run the newest notification's default action (#3734)
* notifications: add invokeLast ipc to run the newest notification's default action * notifications: drop the invokeLast test file
This commit is contained in:
1 parent
aef801fc4b
commit
e2a0b37d03
2 files changed
+17
No files matched your search
@@ -190,6 +190,12 @@ DModal {
|
||||
return "NOTIFICATION_DISMISS_SUCCESS";
|
||||
}
|
||||
|
||||
function invokeLast(): string {
|
||||
if (!NotificationService.invokeLastNotification())
|
||||
return "NOTIFICATION_INVOKE_NO_ACTION";
|
||||
return "NOTIFICATION_INVOKE_SUCCESS";
|
||||
}
|
||||
|
||||
target: "notifications"
|
||||
}
|
||||
|
||||
|
||||
@@ -1049,6 +1049,17 @@ Singleton {
|
||||
dismissNotification(w);
|
||||
}
|
||||
|
||||
function invokeLastNotification() {
|
||||
const w = notifications[notifications.length - 1];
|
||||
const actions = w?.actions || [];
|
||||
const action = actions.find(a => a.identifier === "default") || actions[0];
|
||||
if (!action?.invoke)
|
||||
return false;
|
||||
action.invoke();
|
||||
dismissNotification(w);
|
||||
return true;
|
||||
}
|
||||
|
||||
function dismissAllPopups() {
|
||||
for (const w of visibleNotifications) {
|
||||
if (w) {
|
||||
|
||||
Reference in new issue
Block a user