Bladeren bron

feat(external_api) allow notifications to be configured

master
Tudor-Ovidiu Avram 4 jaren geleden
bovenliggende
commit
d91c546a1e

+ 59
- 0
config.js Bestand weergeven

@@ -691,6 +691,65 @@ var config = {
691 691
      ignoreStartMuted
692 692
      */
693 693
 
694
+    /**
695
+        Use this array to configure which notifications will be shown to the user
696
+        The items correspond to the title or description key of that notification
697
+        Some of these notifications also depend on some other internal logic to be displayed or not,
698
+        so adding them here will not ensure they will always be displayed
699
+
700
+        A falsy value for this prop will result in having all notifications enabled (e.g null, undefined, false)
701
+    */
702
+    // notifications: [
703
+    //     'connection.CONNFAIL', // shown when the connection fails,
704
+    //     'dialog.cameraNotSendingData', // shown when there's no feed from user's camera
705
+    //     'dialog.kickTitle', // shown when user has been kicked
706
+    //     'dialog.liveStreaming', // livestreaming notifications (pending, on, off, limits)
707
+    //     'dialog.lockTitle', // shown when setting conference password fails
708
+    //     'dialog.maxUsersLimitReached', // shown when maximmum users limit has been reached
709
+    //     'dialog.micNotSendingData', // shown when user's mic is not sending any audio
710
+    //     'dialog.passwordNotSupportedTitle', // shown when setting conference password fails due to password format
711
+    //     'dialog.recording', // recording notifications (pending, on, off, limits)
712
+    //     'dialog.remoteControlTitle', // remote control notifications (allowed, denied, start, stop, error)
713
+    //     'dialog.reservationError',
714
+    //     'dialog.serviceUnavailable', // shown when server is not reachable
715
+    //     'dialog.sessTerminated', // shown when there is a failed conference session
716
+    //     'dialog.tokenAuthFailed', // show when an invalid jwt is used
717
+    //     'dialog.transcribing', // transcribing notifications (pending, off)
718
+    //     'dialOut.statusMessage', // shown when dial out status is updated.
719
+    //     'liveStreaming.busy', // shown when livestreaming service is busy
720
+    //     'liveStreaming.failedToStart', // shown when livestreaming fails to start
721
+    //     'liveStreaming.unavailableTitle', // shown when livestreaming service is not reachable
722
+    //     'lobby.joinRejectedMessage', // shown when while in a lobby, user's request to join is rejected
723
+    //     'lobby.notificationTitle', // shown when lobby is toggled and when join requests are allowed / denied
724
+    //     'localRecording.localRecording', // shown when a local recording is started
725
+    //     'notify.disconnected', // shown when a participant has left
726
+    //     'notify.grantedTo', // shown when moderator rights were granted to a participant
727
+    //     'notify.invitedOneMember', // shown when 1 participant has been invited
728
+    //     'notify.invitedThreePlusMembers', // shown when 3+ participants have been invited
729
+    //     'notify.invitedTwoMembers', // shown when 2 participants have been invited
730
+    //     'notify.kickParticipant', // shown when a participant is kicked
731
+    //     'notify.mutedRemotelyTitle', // shown when user is muted by a remote party
732
+    //     'notify.mutedTitle', // shown when user has been muted upon joining,
733
+    //     'notify.newDeviceAudioTitle', // prompts the user to use a newly detected audio device
734
+    //     'notify.newDeviceCameraTitle', // prompts the user to use a newly detected camera
735
+    //     'notify.passwordRemovedRemotely', // shown when a password has been removed remotely
736
+    //     'notify.passwordSetRemotely', // shown when a password has been set remotely
737
+    //     'notify.raisedHand', // shown when a partcipant used raise hand,
738
+    //     'notify.startSilentTitle', // shown when user joined with no audio
739
+    //     'prejoin.errorDialOut',
740
+    //     'prejoin.errorDialOutDisconnected',
741
+    //     'prejoin.errorDialOutFailed',
742
+    //     'prejoin.errorDialOutStatus',
743
+    //     'prejoin.errorStatusCode',
744
+    //     'prejoin.errorValidation',
745
+    //     'recording.busy', // shown when recording service is busy
746
+    //     'recording.failedToStart', // shown when recording fails to start
747
+    //     'recording.unavailableTitle', // shown when recording service is not reachable
748
+    //     'toolbar.noAudioSignalTitle', // shown when a broken mic is detected
749
+    //     'toolbar.noisyAudioInputTitle', // shown when noise is detected for the current microphone
750
+    //     'toolbar.talkWhileMutedPopup', // shown when user tries to speak while muted
751
+    //     'transcribing.failedToStart' // shown when transcribing fails to start
752
+    // ]
694 753
 
695 754
     // Allow all above example options to include a trailing comma and
696 755
     // prevent fear when commenting out the last value.

+ 1
- 0
react/features/base/config/configWhitelist.js Bestand weergeven

@@ -131,6 +131,7 @@ export default [
131 131
     'liveStreamingEnabled',
132 132
     'localRecording',
133 133
     'maxFullResolutionParticipants',
134
+    'notifications',
134 135
     'openBridgeChannel',
135 136
     'openSharedDocumentOnJoin',
136 137
     'opusMaxAverageBitrate',

+ 2
- 2
react/features/local-recording/middleware.js Bestand weergeven

@@ -46,14 +46,14 @@ MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
46 46
 
47 47
         recordingController.onWarning = (messageKey, messageParams) => {
48 48
             dispatch(showNotification({
49
-                title: i18next.t('localRecording.localRecording'),
49
+                titleKey: 'localRecording.localRecording',
50 50
                 description: i18next.t(messageKey, messageParams)
51 51
             }, 10000));
52 52
         };
53 53
 
54 54
         recordingController.onNotify = (messageKey, messageParams) => {
55 55
             dispatch(showNotification({
56
-                title: i18next.t('localRecording.localRecording'),
56
+                titleKey: 'localRecording.localRecording',
57 57
                 description: i18next.t(messageKey, messageParams)
58 58
             }, 10000));
59 59
         };

+ 7
- 7
react/features/no-audio-signal/middleware.js Bestand weergeven

@@ -108,20 +108,20 @@ async function _handleNoAudioSignalNotification({ dispatch, getState }, action)
108 108
             };
109 109
         }
110 110
 
111
-        const notification = showNotification({
111
+        const notification = await dispatch(showNotification({
112 112
             titleKey: 'toolbar.noAudioSignalTitle',
113 113
             description: <DialInLink />,
114 114
             descriptionKey,
115 115
             customActionNameKey,
116 116
             customActionHandler
117
-        });
118
-
119
-        dispatch(notification);
117
+        }));
120 118
 
121 119
         dispatch(playSound(NO_AUDIO_SIGNAL_SOUND_ID));
122 120
 
123
-        // Store the current notification uid so we can check for this state and hide it in case
124
-        // a new track was added, thus changing the context of the notification
125
-        dispatch(setNoAudioSignalNotificationUid(notification.uid));
121
+        if (notification) {
122
+            // Store the current notification uid so we can check for this state and hide it in case
123
+            // a new track was added, thus changing the context of the notification
124
+            dispatch(setNoAudioSignalNotificationUid(notification.uid));
125
+        }
126 126
     });
127 127
 }

+ 7
- 6
react/features/noise-detection/middleware.js Bestand weergeven

@@ -37,17 +37,18 @@ MiddlewareRegistry.register(store => next => action => {
37 37
                 }
38 38
             });
39 39
         conference.on(
40
-            JitsiConferenceEvents.NOISY_MIC, () => {
41
-                const notification = showNotification({
40
+            JitsiConferenceEvents.NOISY_MIC, async () => {
41
+                const notification = await dispatch(showNotification({
42 42
                     titleKey: 'toolbar.noisyAudioInputTitle',
43 43
                     descriptionKey: 'toolbar.noisyAudioInputDesc'
44
-                });
44
+                }));
45 45
 
46
-                dispatch(notification);
47 46
                 dispatch(playSound(NOISY_AUDIO_INPUT_SOUND_ID));
48 47
 
49
-                // we store the last notification id so we can hide it if the mic is muted
50
-                dispatch(setNoisyAudioInputNotificationUid(notification.uid));
48
+                if (notification) {
49
+                    // we store the last notification id so we can hide it if the mic is muted
50
+                    dispatch(setNoisyAudioInputNotificationUid(notification.uid));
51
+                }
51 52
             });
52 53
         break;
53 54
     }

+ 15
- 11
react/features/notifications/actions.js Bestand weergeven

@@ -76,19 +76,23 @@ export function showErrorNotification(props: Object) {
76 76
  * @param {Object} props - The props needed to show the notification component.
77 77
  * @param {number} timeout - How long the notification should display before
78 78
  * automatically being hidden.
79
- * @returns {{
80
- *     type: SHOW_NOTIFICATION,
81
- *     props: Object,
82
- *     timeout: number,
83
- *     uid: number
84
- * }}
79
+ * @returns {Function}
85 80
  */
86 81
 export function showNotification(props: Object = {}, timeout: ?number) {
87
-    return {
88
-        type: SHOW_NOTIFICATION,
89
-        props,
90
-        timeout,
91
-        uid: window.Date.now()
82
+    return function(dispatch: Function, getState: Function) {
83
+        const { notifications } = getState()['features/base/config'];
84
+        const shouldDisplay = !notifications
85
+            || notifications.includes(props.descriptionKey)
86
+            || notifications.includes(props.titleKey);
87
+
88
+        if (shouldDisplay) {
89
+            return dispatch({
90
+                type: SHOW_NOTIFICATION,
91
+                props,
92
+                timeout,
93
+                uid: window.Date.now()
94
+            });
95
+        }
92 96
     };
93 97
 }
94 98
 

+ 6
- 7
react/features/recording/actions.any.js Bestand weergeven

@@ -75,7 +75,7 @@ export function setLiveStreamKey(streamKey: string) {
75 75
  * @returns {Function}
76 76
  */
77 77
 export function showPendingRecordingNotification(streamType: string) {
78
-    return (dispatch: Function) => {
78
+    return async (dispatch: Function) => {
79 79
         const isLiveStreaming
80 80
             = streamType === JitsiMeetJS.constants.recording.mode.STREAM;
81 81
         const dialogProps = isLiveStreaming ? {
@@ -85,15 +85,14 @@ export function showPendingRecordingNotification(streamType: string) {
85 85
             descriptionKey: 'recording.pending',
86 86
             titleKey: 'dialog.recording'
87 87
         };
88
-        const showNotificationAction = showNotification({
88
+        const notification = await dispatch(showNotification({
89 89
             isDismissAllowed: false,
90 90
             ...dialogProps
91
-        });
91
+        }));
92 92
 
93
-        dispatch(showNotificationAction);
94
-
95
-        dispatch(_setPendingRecordingNotificationUid(
96
-            showNotificationAction.uid, streamType));
93
+        if (notification) {
94
+            dispatch(_setPendingRecordingNotificationUid(notification.uid, streamType));
95
+        }
97 96
     };
98 97
 }
99 98
 

+ 8
- 8
react/features/talk-while-muted/middleware.js Bestand weergeven

@@ -40,20 +40,20 @@ MiddlewareRegistry.register(store => next => action => {
40 40
                 }
41 41
             });
42 42
         conference.on(
43
-            JitsiConferenceEvents.TALK_WHILE_MUTED, () => {
44
-                const notification = showNotification({
43
+            JitsiConferenceEvents.TALK_WHILE_MUTED, async () => {
44
+                const notification = await dispatch(showNotification({
45 45
                     titleKey: 'toolbar.talkWhileMutedPopup',
46 46
                     customActionNameKey: 'notify.unmute',
47 47
                     customActionHandler: () => dispatch(setAudioMuted(false))
48
-                });
49
-
50
-                dispatch(notification);
48
+                }));
51 49
 
52 50
                 dispatch(playSound(TALK_WHILE_MUTED_SOUND_ID));
53 51
 
54
-                // we store the last start muted notification id that we showed,
55
-                // so we can hide it when unmuted mic is detected
56
-                dispatch(setCurrentNotificationUid(notification.uid));
52
+                if (notification) {
53
+                    // we store the last start muted notification id that we showed,
54
+                    // so we can hide it when unmuted mic is detected
55
+                    dispatch(setCurrentNotificationUid(notification.uid));
56
+                }
57 57
             });
58 58
         break;
59 59
     }

+ 6
- 7
react/features/transcribing/actions.js Bestand weergeven

@@ -69,17 +69,16 @@ export function potentialTranscriberJoined(participantId: string) {
69 69
  * @returns {Function}
70 70
  */
71 71
 export function showPendingTranscribingNotification() {
72
-    return (dispatch: Function) => {
73
-        const showNotificationAction = showNotification({
72
+    return async (dispatch: Function) => {
73
+        const notification = await dispatch(showNotification({
74 74
             descriptionKey: 'transcribing.pending',
75 75
             isDismissAllowed: false,
76 76
             titleKey: 'dialog.transcribing'
77
-        });
77
+        }));
78 78
 
79
-        dispatch(showNotificationAction);
80
-
81
-        dispatch(setPendingTranscribingNotificationUid(
82
-            showNotificationAction.uid));
79
+        if (notification) {
80
+            dispatch(setPendingTranscribingNotificationUid(notification.uid));
81
+        }
83 82
     };
84 83
 }
85 84
 

Laden…
Annuleren
Opslaan