feat(notifications) trigger iframe api event when a notification occurs (#12952)

* feat(notifications) trigger iframe api event when a notification occurs

* remove useless comment

* fix typo
This commit is contained in:
Avram Tudor 2023-02-27 15:31:54 +02:00 committed by GitHub
parent f14b69166c
commit 336fa304ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 4 deletions

View File

@ -1229,6 +1229,22 @@ class API {
});
}
/**
* Notify the external app that a notification has been triggered.
*
* @param {string} title - The notification title.
* @param {string} description - The notification description.
*
* @returns {void}
*/
notifyNotificationTriggered(title: string, description: string) {
this._sendEvent({
description,
name: 'notification-triggered',
title
});
}
/**
* Notify external application that the video quality setting has changed.
*

View File

@ -127,6 +127,7 @@ const events = {
'mouse-enter': 'mouseEnter',
'mouse-leave': 'mouseLeave',
'mouse-move': 'mouseMove',
'notification-triggered': 'notificationTriggered',
'outgoing-message': 'outgoingMessage',
'participant-joined': 'participantJoined',
'participant-kicked-out': 'participantKickedOut',

View File

@ -116,12 +116,18 @@ export function showNotification(props: INotificationProps = {}, type?: string)
const { disabledNotifications = [], notifications, notificationTimeouts } = getState()['features/base/config'];
const enabledFlag = getFeatureFlag(getState(), NOTIFICATIONS_ENABLED, true);
const { descriptionKey, titleKey } = props;
const shouldDisplay = enabledFlag
&& !(disabledNotifications.includes(props.descriptionKey ?? '')
|| disabledNotifications.includes(props.titleKey ?? ''))
&& !(disabledNotifications.includes(descriptionKey ?? '')
|| disabledNotifications.includes(titleKey ?? ''))
&& (!notifications
|| notifications.includes(props.descriptionKey ?? '')
|| notifications.includes(props.titleKey ?? ''));
|| notifications.includes(descriptionKey ?? '')
|| notifications.includes(titleKey ?? ''));
if (typeof APP !== 'undefined') {
APP.API.notifyNotificationTriggered(titleKey, descriptionKey);
}
if (shouldDisplay) {
return dispatch({