mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
feat: allow specifying actions in custom notifications (#15666)
Co-authored-by: Avram Tudor <tudor.avram@8x8.com>
This commit is contained in:
@@ -596,9 +596,13 @@ function initCommands() {
|
||||
* Defaults to "normal" if not provided.
|
||||
* @param { string } arg.timeout - Timeout type, either `short`, `medium`, `long` or `sticky`.
|
||||
* Defaults to "short" if not provided.
|
||||
* @param { Array<Object> } arg.customActions - An array of custom actions to be displayed in the notification.
|
||||
* Each object should have a `label` and a `uuid` property. It should be used along a listener
|
||||
* for the `customNotificationActionTriggered` event to handle the custom action.
|
||||
* @returns {void}
|
||||
*/
|
||||
'show-notification': ({
|
||||
customActions = [],
|
||||
title,
|
||||
description,
|
||||
uid,
|
||||
@@ -620,7 +624,15 @@ function initCommands() {
|
||||
return;
|
||||
}
|
||||
|
||||
const handlers = customActions.map(({ uuid }) => () => {
|
||||
APP.API.notifyCustomNotificationActionTriggered(uuid);
|
||||
});
|
||||
|
||||
const keys = customActions.map(({ label }) => label);
|
||||
|
||||
APP.store.dispatch(showNotification({
|
||||
customActionHandler: handlers,
|
||||
customActionNameKey: keys,
|
||||
uid,
|
||||
title,
|
||||
description,
|
||||
@@ -1501,6 +1513,21 @@ class API {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify external application (if API is enabled) that a custom notification action has been triggered.
|
||||
*
|
||||
* @param {string} actionUuid - The UUID of the action that has been triggered.
|
||||
* @returns {void}
|
||||
*/
|
||||
notifyCustomNotificationActionTriggered(actionUuid) {
|
||||
this._sendEvent({
|
||||
name: 'custom-notification-action-triggered',
|
||||
data: {
|
||||
id: actionUuid
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify external application (if API is enabled) that the list of sharing participants changed.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user