Browse Source

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.
master
Leonard Kim 7 years ago
parent
commit
7341c7bf84

+ 7
- 11
modules/UI/util/MessageHandler.js View File

4
 import jitsiLocalStorage from '../../util/JitsiLocalStorage';
4
 import jitsiLocalStorage from '../../util/JitsiLocalStorage';
5
 
5
 
6
 import {
6
 import {
7
-    Notification,
8
     showErrorNotification,
7
     showErrorNotification,
9
     showNotification,
8
     showNotification,
10
     showWarningNotification
9
     showWarningNotification
493
             messageKey,
492
             messageKey,
494
             messageArguments,
493
             messageArguments,
495
             timeout = 2500) {
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 View File

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

+ 3
- 8
react/features/notifications/actions.js View File

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

+ 2
- 1
react/features/notifications/components/NotificationsContainer.web.js View File

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

+ 6
- 8
react/features/videosipgw/middleware.js View File

12
 } from '../base/lib-jitsi-meet';
12
 } from '../base/lib-jitsi-meet';
13
 import { MiddlewareRegistry } from '../base/redux';
13
 import { MiddlewareRegistry } from '../base/redux';
14
 import {
14
 import {
15
-    Notification,
16
     showErrorNotification,
15
     showErrorNotification,
17
     showNotification,
16
     showNotification,
18
     showWarningNotification
17
     showWarningNotification
158
         event: Object) {
157
         event: Object) {
159
     switch (event.newState) {
158
     switch (event.newState) {
160
     case JitsiSIPVideoGWStatus.STATE_PENDING: {
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
     case JitsiSIPVideoGWStatus.STATE_FAILED: {
167
     case JitsiSIPVideoGWStatus.STATE_FAILED: {
170
         return showErrorNotification({
168
         return showErrorNotification({

Loading…
Cancel
Save