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:
parent
f14b69166c
commit
336fa304ce
|
@ -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.
|
* Notify external application that the video quality setting has changed.
|
||||||
*
|
*
|
||||||
|
|
|
@ -127,6 +127,7 @@ const events = {
|
||||||
'mouse-enter': 'mouseEnter',
|
'mouse-enter': 'mouseEnter',
|
||||||
'mouse-leave': 'mouseLeave',
|
'mouse-leave': 'mouseLeave',
|
||||||
'mouse-move': 'mouseMove',
|
'mouse-move': 'mouseMove',
|
||||||
|
'notification-triggered': 'notificationTriggered',
|
||||||
'outgoing-message': 'outgoingMessage',
|
'outgoing-message': 'outgoingMessage',
|
||||||
'participant-joined': 'participantJoined',
|
'participant-joined': 'participantJoined',
|
||||||
'participant-kicked-out': 'participantKickedOut',
|
'participant-kicked-out': 'participantKickedOut',
|
||||||
|
|
|
@ -116,12 +116,18 @@ export function showNotification(props: INotificationProps = {}, type?: string)
|
||||||
const { disabledNotifications = [], notifications, notificationTimeouts } = getState()['features/base/config'];
|
const { disabledNotifications = [], notifications, notificationTimeouts } = getState()['features/base/config'];
|
||||||
const enabledFlag = getFeatureFlag(getState(), NOTIFICATIONS_ENABLED, true);
|
const enabledFlag = getFeatureFlag(getState(), NOTIFICATIONS_ENABLED, true);
|
||||||
|
|
||||||
|
const { descriptionKey, titleKey } = props;
|
||||||
|
|
||||||
const shouldDisplay = enabledFlag
|
const shouldDisplay = enabledFlag
|
||||||
&& !(disabledNotifications.includes(props.descriptionKey ?? '')
|
&& !(disabledNotifications.includes(descriptionKey ?? '')
|
||||||
|| disabledNotifications.includes(props.titleKey ?? ''))
|
|| disabledNotifications.includes(titleKey ?? ''))
|
||||||
&& (!notifications
|
&& (!notifications
|
||||||
|| notifications.includes(props.descriptionKey ?? '')
|
|| notifications.includes(descriptionKey ?? '')
|
||||||
|| notifications.includes(props.titleKey ?? ''));
|
|| notifications.includes(titleKey ?? ''));
|
||||||
|
|
||||||
|
if (typeof APP !== 'undefined') {
|
||||||
|
APP.API.notifyNotificationTriggered(titleKey, descriptionKey);
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldDisplay) {
|
if (shouldDisplay) {
|
||||||
return dispatch({
|
return dispatch({
|
||||||
|
|
Loading…
Reference in New Issue