소스 검색

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
factor2
Avram Tudor 2 년 전
부모
커밋
336fa304ce
No account linked to committer's email address
3개의 변경된 파일27개의 추가작업 그리고 4개의 파일을 삭제
  1. 16
    0
      modules/API/API.js
  2. 1
    0
      modules/API/external/external_api.js
  3. 10
    4
      react/features/notifications/actions.ts

+ 16
- 0
modules/API/API.js 파일 보기

@@ -1229,6 +1229,22 @@ class API {
1229 1229
         });
1230 1230
     }
1231 1231
 
1232
+    /**
1233
+     * Notify the external app that a notification has been triggered.
1234
+     *
1235
+     * @param {string} title - The notification title.
1236
+     * @param {string} description - The notification description.
1237
+     *
1238
+     * @returns {void}
1239
+     */
1240
+    notifyNotificationTriggered(title: string, description: string) {
1241
+        this._sendEvent({
1242
+            description,
1243
+            name: 'notification-triggered',
1244
+            title
1245
+        });
1246
+    }
1247
+
1232 1248
     /**
1233 1249
      * Notify external application that the video quality setting has changed.
1234 1250
      *

+ 1
- 0
modules/API/external/external_api.js 파일 보기

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

+ 10
- 4
react/features/notifications/actions.ts 파일 보기

@@ -116,12 +116,18 @@ export function showNotification(props: INotificationProps = {}, type?: string)
116 116
         const { disabledNotifications = [], notifications, notificationTimeouts } = getState()['features/base/config'];
117 117
         const enabledFlag = getFeatureFlag(getState(), NOTIFICATIONS_ENABLED, true);
118 118
 
119
+        const { descriptionKey, titleKey } = props;
120
+
119 121
         const shouldDisplay = enabledFlag
120
-            && !(disabledNotifications.includes(props.descriptionKey ?? '')
121
-                || disabledNotifications.includes(props.titleKey ?? ''))
122
+            && !(disabledNotifications.includes(descriptionKey ?? '')
123
+                || disabledNotifications.includes(titleKey ?? ''))
122 124
             && (!notifications
123
-                || notifications.includes(props.descriptionKey ?? '')
124
-                || notifications.includes(props.titleKey ?? ''));
125
+                || notifications.includes(descriptionKey ?? '')
126
+                || notifications.includes(titleKey ?? ''));
127
+
128
+        if (typeof APP !== 'undefined') {
129
+            APP.API.notifyNotificationTriggered(titleKey, descriptionKey);
130
+        }
125 131
 
126 132
         if (shouldDisplay) {
127 133
             return dispatch({

Loading…
취소
저장