Skip to content

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

Extract notification timeout to a constant

Bettenbuk Zoltan5d9762b42970
diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js
index c1a7028e6d..4516fa1305 100644
--- a/modules/UI/util/MessageHandler.js
+++ b/modules/UI/util/MessageHandler.js
@@ -4,6 +4,7 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
import jitsiLocalStorage from '../../util/JitsiLocalStorage';
import {
+ NOTIFICATION_TIMEOUT,
showErrorNotification,
showNotification,
showWarningNotification
@@ -454,7 +455,7 @@ const messageHandler = {
cls,
messageKey,
messageArguments,
- timeout = 2500) {
+ timeout = NOTIFICATION_TIMEOUT) {
APP.store.dispatch(showNotification({
descriptionArguments: messageArguments,
descriptionKey: messageKey,
diff --git a/react/features/base/participants/actions.js b/react/features/base/participants/actions.js
index 919a158123..a1fed4d50f 100644
--- a/react/features/base/participants/actions.js
+++ b/react/features/base/participants/actions.js
@@ -3,7 +3,7 @@
import throttle from 'lodash/throttle';
import { set } from '../redux';
-import { showNotification } from '../../notifications';
+import { NOTIFICATION_TIMEOUT, showNotification } from '../../notifications';
import {
DOMINANT_SPEAKER_CHANGED,
@@ -452,7 +452,7 @@ const _throttledNotifyParticipantConnected = throttle(dispatch => {
if (notificationProps) {
dispatch(
- showNotification(notificationProps, 2500));
+ showNotification(notificationProps, NOTIFICATION_TIMEOUT));
}
joinedParticipantsNames = [];
diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js
index 7eb125b169..fcd335dabc 100644
--- a/react/features/base/participants/middleware.js
+++ b/react/features/base/participants/middleware.js
@@ -2,7 +2,7 @@
import UIEvents from '../../../../service/UI/UIEvents';
-import { showNotification } from '../../notifications';
+import { NOTIFICATION_TIMEOUT, showNotification } from '../../notifications';
import { CALLING, INVITED } from '../../presence-status';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
@@ -395,7 +395,7 @@ function _raiseHandUpdated({ dispatch, getState }, conference, participant, newV
name: getParticipantDisplayName(getState, participant.getId())
},
titleKey: 'notify.raisedHand'
- }, 2500));
+ }, NOTIFICATION_TIMEOUT));
}
}
diff --git a/react/features/notifications/constants.js b/react/features/notifications/constants.js
index 38ade8b8bc..643871a6b3 100644
--- a/react/features/notifications/constants.js
+++ b/react/features/notifications/constants.js
@@ -1,5 +1,10 @@
// @flow
+/**
+ * The standard time when auto-disappearing notifications should disappear.
+ */
+export const NOTIFICATION_TIMEOUT = 2500;
+
/**
* The set of possible notification types.
*
diff --git a/react/features/notifications/index.js b/react/features/notifications/index.js
index e00e0841f1..2e85be6d3c 100644
--- a/react/features/notifications/index.js
+++ b/react/features/notifications/index.js
@@ -3,6 +3,7 @@
export * from './actions';
export * from './actionTypes';
export * from './components';
+export * from './constants';
export * from './functions';
import './middleware';
diff --git a/react/features/recording/actions.js b/react/features/recording/actions.js
index 28013e29d5..899f3018a5 100644
--- a/react/features/recording/actions.js
+++ b/react/features/recording/actions.js
@@ -2,6 +2,7 @@
import JitsiMeetJS, { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
import {
+ NOTIFICATION_TIMEOUT,
hideNotification,
showErrorNotification,
showNotification
@@ -125,7 +126,7 @@ export function showStoppedRecordingNotification(streamType: string) {
titleKey: 'dialog.recording'
};
- return showNotification(dialogProps, 2500);
+ return showNotification(dialogProps, NOTIFICATION_TIMEOUT);
}
/**
diff --git a/react/features/transcribing/actions.js b/react/features/transcribing/actions.js
index 8fc20bc2e1..7765f6f6d5 100644
--- a/react/features/transcribing/actions.js
+++ b/react/features/transcribing/actions.js
@@ -10,6 +10,7 @@ import {
STOP_TRANSCRIBING
} from './actionTypes';
import {
+ NOTIFICATION_TIMEOUT,
hideNotification,
showErrorNotification,
showNotification
@@ -161,7 +162,7 @@ export function hidePendingTranscribingNotification() {
/**
* Signals that the stopped transcribing notification should be shown on the
- * screen for a 2500 ms.
+ * screen.
*
* @returns {showNotification}
*/
@@ -169,7 +170,7 @@ export function showStoppedTranscribingNotification() {
return showNotification({
descriptionKey: 'transcribing.off',
titleKey: 'dialog.transcribing'
- }, 2500);
+ }, NOTIFICATION_TIMEOUT);
}