Browse Source

Extract notification timeout to a constant

master
Bettenbuk Zoltan 6 years ago
parent
commit
5d9762b429

+ 2
- 1
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_TIMEOUT,
7
     showErrorNotification,
8
     showErrorNotification,
8
     showNotification,
9
     showNotification,
9
     showWarningNotification
10
     showWarningNotification
454
             cls,
455
             cls,
455
             messageKey,
456
             messageKey,
456
             messageArguments,
457
             messageArguments,
457
-            timeout = 2500) {
458
+            timeout = NOTIFICATION_TIMEOUT) {
458
         APP.store.dispatch(showNotification({
459
         APP.store.dispatch(showNotification({
459
             descriptionArguments: messageArguments,
460
             descriptionArguments: messageArguments,
460
             descriptionKey: messageKey,
461
             descriptionKey: messageKey,

+ 2
- 2
react/features/base/participants/actions.js View File

3
 import throttle from 'lodash/throttle';
3
 import throttle from 'lodash/throttle';
4
 
4
 
5
 import { set } from '../redux';
5
 import { set } from '../redux';
6
-import { showNotification } from '../../notifications';
6
+import { NOTIFICATION_TIMEOUT, showNotification } from '../../notifications';
7
 
7
 
8
 import {
8
 import {
9
     DOMINANT_SPEAKER_CHANGED,
9
     DOMINANT_SPEAKER_CHANGED,
452
 
452
 
453
     if (notificationProps) {
453
     if (notificationProps) {
454
         dispatch(
454
         dispatch(
455
-            showNotification(notificationProps, 2500));
455
+            showNotification(notificationProps, NOTIFICATION_TIMEOUT));
456
     }
456
     }
457
 
457
 
458
     joinedParticipantsNames = [];
458
     joinedParticipantsNames = [];

+ 2
- 2
react/features/base/participants/middleware.js View File

2
 
2
 
3
 import UIEvents from '../../../../service/UI/UIEvents';
3
 import UIEvents from '../../../../service/UI/UIEvents';
4
 
4
 
5
-import { showNotification } from '../../notifications';
5
+import { NOTIFICATION_TIMEOUT, showNotification } from '../../notifications';
6
 import { CALLING, INVITED } from '../../presence-status';
6
 import { CALLING, INVITED } from '../../presence-status';
7
 
7
 
8
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
8
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
395
                 name: getParticipantDisplayName(getState, participant.getId())
395
                 name: getParticipantDisplayName(getState, participant.getId())
396
             },
396
             },
397
             titleKey: 'notify.raisedHand'
397
             titleKey: 'notify.raisedHand'
398
-        }, 2500));
398
+        }, NOTIFICATION_TIMEOUT));
399
     }
399
     }
400
 }
400
 }
401
 
401
 

+ 5
- 0
react/features/notifications/constants.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
+/**
4
+ * The standard time when auto-disappearing notifications should disappear.
5
+ */
6
+export const NOTIFICATION_TIMEOUT = 2500;
7
+
3
 /**
8
 /**
4
  * The set of possible notification types.
9
  * The set of possible notification types.
5
  *
10
  *

+ 1
- 0
react/features/notifications/index.js View File

3
 export * from './actions';
3
 export * from './actions';
4
 export * from './actionTypes';
4
 export * from './actionTypes';
5
 export * from './components';
5
 export * from './components';
6
+export * from './constants';
6
 export * from './functions';
7
 export * from './functions';
7
 
8
 
8
 import './middleware';
9
 import './middleware';

+ 2
- 1
react/features/recording/actions.js View File

2
 
2
 
3
 import JitsiMeetJS, { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
3
 import JitsiMeetJS, { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
4
 import {
4
 import {
5
+    NOTIFICATION_TIMEOUT,
5
     hideNotification,
6
     hideNotification,
6
     showErrorNotification,
7
     showErrorNotification,
7
     showNotification
8
     showNotification
125
         titleKey: 'dialog.recording'
126
         titleKey: 'dialog.recording'
126
     };
127
     };
127
 
128
 
128
-    return showNotification(dialogProps, 2500);
129
+    return showNotification(dialogProps, NOTIFICATION_TIMEOUT);
129
 }
130
 }
130
 
131
 
131
 /**
132
 /**

+ 3
- 2
react/features/transcribing/actions.js View File

10
     STOP_TRANSCRIBING
10
     STOP_TRANSCRIBING
11
 } from './actionTypes';
11
 } from './actionTypes';
12
 import {
12
 import {
13
+    NOTIFICATION_TIMEOUT,
13
     hideNotification,
14
     hideNotification,
14
     showErrorNotification,
15
     showErrorNotification,
15
     showNotification
16
     showNotification
161
 
162
 
162
 /**
163
 /**
163
  * Signals that the stopped transcribing notification should be shown on the
164
  * Signals that the stopped transcribing notification should be shown on the
164
- * screen for a 2500 ms.
165
+ * screen.
165
  *
166
  *
166
  * @returns {showNotification}
167
  * @returns {showNotification}
167
  */
168
  */
169
     return showNotification({
170
     return showNotification({
170
         descriptionKey: 'transcribing.off',
171
         descriptionKey: 'transcribing.off',
171
         titleKey: 'dialog.transcribing'
172
         titleKey: 'dialog.transcribing'
172
-    }, 2500);
173
+    }, NOTIFICATION_TIMEOUT);
173
 }
174
 }
174
 
175
 
175
 
176
 

Loading…
Cancel
Save