瀏覽代碼

ref(notifications): stop passing around Notifications component

Passing around of the component was used when there were two
independent Notification components. Now that there is only
one Notification component, it is not necessary to pass
around the component.
j8
Leonard Kim 7 年之前
父節點
當前提交
7341c7bf84

+ 7
- 11
modules/UI/util/MessageHandler.js 查看文件

@@ -4,7 +4,6 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
4 4
 import jitsiLocalStorage from '../../util/JitsiLocalStorage';
5 5
 
6 6
 import {
7
-    Notification,
8 7
     showErrorNotification,
9 8
     showNotification,
10 9
     showWarningNotification
@@ -493,16 +492,13 @@ const messageHandler = {
493 492
             messageKey,
494 493
             messageArguments,
495 494
             timeout = 2500) {
496
-        APP.store.dispatch(
497
-            showNotification(
498
-                Notification,
499
-                {
500
-                    descriptionArguments: messageArguments,
501
-                    descriptionKey: messageKey,
502
-                    titleKey: displayNameKey,
503
-                    title: displayName
504
-                },
505
-                timeout));
495
+        APP.store.dispatch(showNotification({
496
+            descriptionArguments: messageArguments,
497
+            descriptionKey: messageKey,
498
+            titleKey: displayNameKey,
499
+            title: displayName
500
+        },
501
+        timeout));
506 502
     },
507 503
 
508 504
     /**

+ 2
- 5
react/features/base/participants/actions.js 查看文件

@@ -2,7 +2,7 @@
2 2
 
3 3
 import throttle from 'lodash/throttle';
4 4
 
5
-import { Notification, showNotification } from '../../notifications';
5
+import { showNotification } from '../../notifications';
6 6
 
7 7
 import {
8 8
     DOMINANT_SPEAKER_CHANGED,
@@ -374,10 +374,7 @@ const _throttledNotifyParticipantConnected = throttle(dispatch => {
374 374
 
375 375
     if (notificationProps) {
376 376
         dispatch(
377
-            showNotification(
378
-                Notification,
379
-                notificationProps,
380
-                2500));
377
+            showNotification(notificationProps, 2500));
381 378
     }
382 379
 
383 380
     joinedParticipantsNames = [];

+ 3
- 8
react/features/notifications/actions.js 查看文件

@@ -3,7 +3,6 @@ import {
3 3
     SET_NOTIFICATIONS_ENABLED,
4 4
     SHOW_NOTIFICATION
5 5
 } from './actionTypes';
6
-import { Notification } from './components';
7 6
 
8 7
 import { NOTIFICATION_TYPE } from './constants';
9 8
 
@@ -47,7 +46,7 @@ export function setNotificationsEnabled(enabled) {
47 46
  * @returns {Object}
48 47
  */
49 48
 export function showErrorNotification(props) {
50
-    return showNotification(Notification, {
49
+    return showNotification({
51 50
         ...props,
52 51
         appearance: NOTIFICATION_TYPE.ERROR
53 52
     });
@@ -56,23 +55,19 @@ export function showErrorNotification(props) {
56 55
 /**
57 56
  * Queues a notification for display.
58 57
  *
59
- * @param {ReactComponent} component - The notification component to be
60
- * displayed.
61 58
  * @param {Object} props - The props needed to show the notification component.
62 59
  * @param {number} timeout - How long the notification should display before
63 60
  * automatically being hidden.
64 61
  * @returns {{
65 62
  *     type: SHOW_NOTIFICATION,
66
- *     component: ReactComponent,
67 63
  *     props: Object,
68 64
  *     timeout: number,
69 65
  *     uid: number
70 66
  * }}
71 67
  */
72
-export function showNotification(component, props = {}, timeout) {
68
+export function showNotification(props = {}, timeout) {
73 69
     return {
74 70
         type: SHOW_NOTIFICATION,
75
-        component,
76 71
         props,
77 72
         timeout,
78 73
         uid: window.Date.now()
@@ -86,7 +81,7 @@ export function showNotification(component, props = {}, timeout) {
86 81
  * @returns {Object}
87 82
  */
88 83
 export function showWarningNotification(props) {
89
-    return showNotification(Notification, {
84
+    return showNotification({
90 85
         ...props,
91 86
         appearance: NOTIFICATION_TYPE.WARNING
92 87
     });

+ 2
- 1
react/features/notifications/components/NotificationsContainer.web.js 查看文件

@@ -5,6 +5,8 @@ import { connect } from 'react-redux';
5 5
 
6 6
 import { hideNotification } from '../actions';
7 7
 
8
+import { Notification } from './';
9
+
8 10
 /**
9 11
  * Implements a React {@link Component} which displays notifications and handles
10 12
  * automatic dismissmal after a notification is shown for a defined timeout
@@ -142,7 +144,6 @@ class NotificationsContainer extends Component {
142 144
         }
143 145
 
144 146
         return _notifications.map(notification => {
145
-            const Notification = notification.component;
146 147
             const { props, uid } = notification;
147 148
 
148 149
             // The id attribute is necessary as {@code FlagGroup} looks for

+ 6
- 8
react/features/videosipgw/middleware.js 查看文件

@@ -12,7 +12,6 @@ import {
12 12
 } from '../base/lib-jitsi-meet';
13 13
 import { MiddlewareRegistry } from '../base/redux';
14 14
 import {
15
-    Notification,
16 15
     showErrorNotification,
17 16
     showNotification,
18 17
     showWarningNotification
@@ -158,13 +157,12 @@ function _sessionStateChanged(
158 157
         event: Object) {
159 158
     switch (event.newState) {
160 159
     case JitsiSIPVideoGWStatus.STATE_PENDING: {
161
-        return showNotification(
162
-            Notification, {
163
-                titleKey: 'videoSIPGW.pending',
164
-                titleArguments: {
165
-                    displayName: event.displayName
166
-                }
167
-            }, 2000);
160
+        return showNotification({
161
+            titleKey: 'videoSIPGW.pending',
162
+            titleArguments: {
163
+                displayName: event.displayName
164
+            }
165
+        }, 2000);
168 166
     }
169 167
     case JitsiSIPVideoGWStatus.STATE_FAILED: {
170 168
         return showErrorNotification({

Loading…
取消
儲存