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.
pull/2446/head
Leonard Kim 7 years ago committed by yanas
parent 5d31532cbb
commit 7341c7bf84
  1. 18
      modules/UI/util/MessageHandler.js
  2. 7
      react/features/base/participants/actions.js
  3. 11
      react/features/notifications/actions.js
  4. 3
      react/features/notifications/components/NotificationsContainer.web.js
  5. 14
      react/features/videosipgw/middleware.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));
},
/**

@ -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 = [];

@ -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
});

@ -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

@ -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({

Loading…
Cancel
Save