Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(notifications): stop passing around Notifications component

Leonard Kim7341c7bf843c
diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js
index 2e9a63fcb4..c6c8d736d3 100644
--- a/modules/UI/util/MessageHandler.js
+++ b/modules/UI/util/MessageHandler.js
@@ -4,7 +4,6 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
import jitsiLocalStorage from '../../util/JitsiLocalStorage';
import {
- Notification,
showErrorNotification,
showNotification,
showWarningNotification
@@ -493,16 +492,13 @@ const messageHandler = {
messageKey,
messageArguments,
timeout = 2500) {
- APP.store.dispatch(
- showNotification(
- Notification,
- {
- descriptionArguments: messageArguments,
- descriptionKey: messageKey,
- titleKey: displayNameKey,
- title: displayName
- },
- timeout));
+ APP.store.dispatch(showNotification({
+ descriptionArguments: messageArguments,
+ descriptionKey: messageKey,
+ titleKey: displayNameKey,
+ title: displayName
+ },
+ timeout));
},
/**
diff --git a/react/features/base/participants/actions.js b/react/features/base/participants/actions.js
index 41b2d2bb24..f3bbe98f0a 100644
--- a/react/features/base/participants/actions.js
+++ b/react/features/base/participants/actions.js
@@ -2,7 +2,7 @@
import throttle from 'lodash/throttle';
-import { Notification, showNotification } from '../../notifications';
+import { showNotification } from '../../notifications';
import {
DOMINANT_SPEAKER_CHANGED,
@@ -374,10 +374,7 @@ const _throttledNotifyParticipantConnected = throttle(dispatch => {
if (notificationProps) {
dispatch(
- showNotification(
- Notification,
- notificationProps,
- 2500));
+ showNotification(notificationProps, 2500));
}
joinedParticipantsNames = [];
diff --git a/react/features/notifications/actions.js b/react/features/notifications/actions.js
index 164d633dc1..95164aabec 100644
--- a/react/features/notifications/actions.js
+++ b/react/features/notifications/actions.js
@@ -3,7 +3,6 @@ import {
SET_NOTIFICATIONS_ENABLED,
SHOW_NOTIFICATION
} from './actionTypes';
-import { Notification } from './components';
import { NOTIFICATION_TYPE } from './constants';
@@ -47,7 +46,7 @@ export function setNotificationsEnabled(enabled) {
* @returns {Object}
*/
export function showErrorNotification(props) {
- return showNotification(Notification, {
+ return showNotification({
...props,
appearance: NOTIFICATION_TYPE.ERROR
});
@@ -56,23 +55,19 @@ export function showErrorNotification(props) {
/**
* Queues a notification for display.
*
- * @param {ReactComponent} component - The notification component to be
- * displayed.
* @param {Object} props - The props needed to show the notification component.
* @param {number} timeout - How long the notification should display before
* automatically being hidden.
* @returns {{
* type: SHOW_NOTIFICATION,
- * component: ReactComponent,
* props: Object,
* timeout: number,
* uid: number
* }}
*/
-export function showNotification(component, props = {}, timeout) {
+export function showNotification(props = {}, timeout) {
return {
type: SHOW_NOTIFICATION,
- component,
props,
timeout,
uid: window.Date.now()
@@ -86,7 +81,7 @@ export function showNotification(component, props = {}, timeout) {
* @returns {Object}
*/
export function showWarningNotification(props) {
- return showNotification(Notification, {
+ return showNotification({
...props,
appearance: NOTIFICATION_TYPE.WARNING
});
diff --git a/react/features/notifications/components/NotificationsContainer.web.js b/react/features/notifications/components/NotificationsContainer.web.js
index 481ccbd9e0..9f3b787890 100644
--- a/react/features/notifications/components/NotificationsContainer.web.js
+++ b/react/features/notifications/components/NotificationsContainer.web.js
@@ -5,6 +5,8 @@ import { connect } from 'react-redux';
import { hideNotification } from '../actions';
+import { Notification } from './';
+
/**
* Implements a React {@link Component} which displays notifications and handles
* automatic dismissmal after a notification is shown for a defined timeout
@@ -142,7 +144,6 @@ class NotificationsContainer extends Component {
}
return _notifications.map(notification => {
- const Notification = notification.component;
const { props, uid } = notification;
// The id attribute is necessary as {@code FlagGroup} looks for
diff --git a/react/features/videosipgw/middleware.js b/react/features/videosipgw/middleware.js
index 3bd0d32fcc..f29a3f7fd7 100644
--- a/react/features/videosipgw/middleware.js
+++ b/react/features/videosipgw/middleware.js
@@ -12,7 +12,6 @@ import {
} from '../base/lib-jitsi-meet';
import { MiddlewareRegistry } from '../base/redux';
import {
- Notification,
showErrorNotification,
showNotification,
showWarningNotification
@@ -158,13 +157,12 @@ function _sessionStateChanged(
event: Object) {
switch (event.newState) {
case JitsiSIPVideoGWStatus.STATE_PENDING: {
- return showNotification(
- Notification, {
- titleKey: 'videoSIPGW.pending',
- titleArguments: {
- displayName: event.displayName
- }
- }, 2000);
+ return showNotification({
+ titleKey: 'videoSIPGW.pending',
+ titleArguments: {
+ displayName: event.displayName
+ }
+ }, 2000);
}
case JitsiSIPVideoGWStatus.STATE_FAILED: {
return showErrorNotification({