Sfoglia il codice sorgente

feat(API): expose recording consent to external api (#16141)

* expose recording consent to api

* Update react/features/recording/actions.web.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
j25
Andrei Gavrilescu 3 mesi fa
parent
commit
a4c20469cd
Nessun account collegato all'indirizzo email del committer

+ 18
- 0
modules/API/API.js Vedi File

108
 } from '../../react/features/participants-pane/actions';
108
 } from '../../react/features/participants-pane/actions';
109
 import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/participants-pane/functions';
109
 import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/participants-pane/functions';
110
 import { startLocalVideoRecording, stopLocalVideoRecording } from '../../react/features/recording/actions.any';
110
 import { startLocalVideoRecording, stopLocalVideoRecording } from '../../react/features/recording/actions.any';
111
+import { grantRecordingConsent, grantRecordingConsentAndUnmute } from '../../react/features/recording/actions.web';
111
 import { RECORDING_METADATA_ID, RECORDING_TYPES } from '../../react/features/recording/constants';
112
 import { RECORDING_METADATA_ID, RECORDING_TYPES } from '../../react/features/recording/constants';
112
 import { getActiveSession, supportsLocalRecording } from '../../react/features/recording/functions';
113
 import { getActiveSession, supportsLocalRecording } from '../../react/features/recording/functions';
113
 import { startAudioScreenShareFlow, startScreenShareFlow } from '../../react/features/screen-share/actions';
114
 import { startAudioScreenShareFlow, startScreenShareFlow } from '../../react/features/screen-share/actions';
209
             }
210
             }
210
             APP.store.dispatch(grantModerator(participantId));
211
             APP.store.dispatch(grantModerator(participantId));
211
         },
212
         },
213
+        'grant-recording-consent': unmute => {
214
+            unmute ? APP.store.dispatch(grantRecordingConsentAndUnmute())
215
+                : APP.store.dispatch(grantRecordingConsent());
216
+        },
212
         'display-name': displayName => {
217
         'display-name': displayName => {
213
             sendAnalytics(createApiEvent('display.name.changed'));
218
             sendAnalytics(createApiEvent('display.name.changed'));
214
             APP.store.dispatch(updateSettings({ displayName: getNormalizedDisplayName(displayName) }));
219
             APP.store.dispatch(updateSettings({ displayName: getNormalizedDisplayName(displayName) }));
1918
         });
1923
         });
1919
     }
1924
     }
1920
 
1925
 
1926
+    /**
1927
+     * Notify external application (if API is enabled) that the recording consent dialog open state has changed.
1928
+     *
1929
+     * @param {boolean} open - True if the dialog is open, false otherwise.
1930
+     * @returns {void}
1931
+     */
1932
+    notifyRecordingConsentDialogOpen(open) {
1933
+        this._sendEvent({
1934
+            name: 'recording-consent-dialog-open',
1935
+            open
1936
+        });
1937
+    }
1938
+
1921
     /**
1939
     /**
1922
      * Notify external application of the current meeting requiring a password
1940
      * Notify external application of the current meeting requiring a password
1923
      * to join.
1941
      * to join.

+ 2
- 0
modules/API/external/external_api.js Vedi File

38
     endConference: 'end-conference',
38
     endConference: 'end-conference',
39
     email: 'email',
39
     email: 'email',
40
     grantModerator: 'grant-moderator',
40
     grantModerator: 'grant-moderator',
41
+    grantRecordingConsent: 'grant-recording-consent',
41
     hangup: 'video-hangup',
42
     hangup: 'video-hangup',
42
     hideNotification: 'hide-notification',
43
     hideNotification: 'hide-notification',
43
     initiatePrivateChat: 'initiate-private-chat',
44
     initiatePrivateChat: 'initiate-private-chat',
151
     'proxy-connection-event': 'proxyConnectionEvent',
152
     'proxy-connection-event': 'proxyConnectionEvent',
152
     'raise-hand-updated': 'raiseHandUpdated',
153
     'raise-hand-updated': 'raiseHandUpdated',
153
     'ready': 'ready',
154
     'ready': 'ready',
155
+    'recording-consent-dialog-open': 'recordingConsentDialogOpen',
154
     'recording-link-available': 'recordingLinkAvailable',
156
     'recording-link-available': 'recordingLinkAvailable',
155
     'recording-status-changed': 'recordingStatusChanged',
157
     'recording-status-changed': 'recordingStatusChanged',
156
     'participant-menu-button-clicked': 'participantMenuButtonClick',
158
     'participant-menu-button-clicked': 'participantMenuButtonClick',

+ 41
- 1
react/features/recording/actions.web.tsx Vedi File

1
 import React from 'react';
1
 import React from 'react';
2
+import { batch } from 'react-redux';
2
 
3
 
3
 import { IStore } from '../app/types';
4
 import { IStore } from '../app/types';
4
-import { openDialog } from '../base/dialog/actions';
5
+import { hideDialog, openDialog } from '../base/dialog/actions';
5
 import JitsiMeetJS from '../base/lib-jitsi-meet';
6
 import JitsiMeetJS from '../base/lib-jitsi-meet';
7
+import {
8
+    setAudioMuted,
9
+    setAudioUnmutePermissions,
10
+    setVideoMuted,
11
+    setVideoUnmutePermissions
12
+} from '../base/media/actions';
13
+import { VIDEO_MUTISM_AUTHORITY } from '../base/media/constants';
6
 import { showNotification } from '../notifications/actions';
14
 import { showNotification } from '../notifications/actions';
7
 import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
15
 import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
8
 
16
 
12
 
20
 
13
 export * from './actions.any';
21
 export * from './actions.any';
14
 
22
 
23
+/**
24
+ * Grants recording consent by setting audio and video unmute permissions.
25
+ *
26
+ * @returns {Function}
27
+ */
28
+export function grantRecordingConsent() {
29
+    return (dispatch: IStore['dispatch']) => {
30
+        batch(() => {
31
+            dispatch(setAudioUnmutePermissions(false, true));
32
+            dispatch(setVideoUnmutePermissions(false, true));
33
+            dispatch(hideDialog());
34
+        });
35
+    };
36
+}
37
+
38
+/**
39
+ * Grants recording consent, unmutes audio/video, and closes the dialog.
40
+ *
41
+ * @returns {Function}
42
+ */
43
+export function grantRecordingConsentAndUnmute() {
44
+    return (dispatch: IStore['dispatch']) => {
45
+        batch(() => {
46
+            dispatch(setAudioUnmutePermissions(false, true));
47
+            dispatch(setVideoUnmutePermissions(false, true));
48
+            dispatch(setAudioMuted(false, true));
49
+            dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.USER, true));
50
+            dispatch(hideDialog());
51
+        });
52
+    };
53
+}
54
+
15
 /**
55
 /**
16
  * Signals that a started recording notification should be shown on the
56
  * Signals that a started recording notification should be shown on the
17
  * screen for a given period.
57
  * screen for a given period.

+ 14
- 21
react/features/recording/components/Recording/web/RecordingConsentDialog.tsx Vedi File

1
-import React, { useCallback } from 'react';
1
+import React, { useCallback, useEffect } from 'react';
2
 import { useTranslation } from 'react-i18next';
2
 import { useTranslation } from 'react-i18next';
3
-import { batch, useDispatch, useSelector } from 'react-redux';
3
+import { useDispatch, useSelector } from 'react-redux';
4
 
4
 
5
 import { IReduxState } from '../../../../app/types';
5
 import { IReduxState } from '../../../../app/types';
6
-import { hideDialog } from '../../../../base/dialog/actions';
7
 import { translateToHTML } from '../../../../base/i18n/functions';
6
 import { translateToHTML } from '../../../../base/i18n/functions';
8
-import {
9
-    setAudioMuted,
10
-    setAudioUnmutePermissions,
11
-    setVideoMuted,
12
-    setVideoUnmutePermissions
13
-} from '../../../../base/media/actions';
14
-import { VIDEO_MUTISM_AUTHORITY } from '../../../../base/media/constants';
15
 import Dialog from '../../../../base/ui/components/web/Dialog';
7
 import Dialog from '../../../../base/ui/components/web/Dialog';
8
+import { grantRecordingConsent, grantRecordingConsentAndUnmute } from '../../../actions.web';
9
+
16
 
10
 
17
 /**
11
 /**
18
  * Component that renders the dialog for explicit consent for recordings.
12
  * Component that renders the dialog for explicit consent for recordings.
26
     const { consentLearnMoreLink } = recordings ?? {};
20
     const { consentLearnMoreLink } = recordings ?? {};
27
     const learnMore = ` (<a href="${consentLearnMoreLink}" target="_blank" rel="noopener noreferrer">${t('dialog.learnMore')}</a>)`;
21
     const learnMore = ` (<a href="${consentLearnMoreLink}" target="_blank" rel="noopener noreferrer">${t('dialog.learnMore')}</a>)`;
28
 
22
 
23
+    useEffect(() => {
24
+        APP.API.notifyRecordingConsentDialogOpen(true);
25
+
26
+        return () => {
27
+            APP.API.notifyRecordingConsentDialogOpen(false);
28
+        };
29
+    }, []);
30
+
29
     const consent = useCallback(() => {
31
     const consent = useCallback(() => {
30
-        batch(() => {
31
-            dispatch(setAudioUnmutePermissions(false, true));
32
-            dispatch(setVideoUnmutePermissions(false, true));
33
-        });
32
+        dispatch(grantRecordingConsent());
34
     }, []);
33
     }, []);
35
 
34
 
36
     const consentAndUnmute = useCallback(() => {
35
     const consentAndUnmute = useCallback(() => {
37
-        batch(() => {
38
-            dispatch(setAudioUnmutePermissions(false, true));
39
-            dispatch(setVideoUnmutePermissions(false, true));
40
-            dispatch(setAudioMuted(false, true));
41
-            dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.USER, true));
42
-            dispatch(hideDialog());
43
-        });
36
+        dispatch(grantRecordingConsentAndUnmute());
44
     }, []);
37
     }, []);
45
 
38
 
46
     return (
39
     return (

Loading…
Annulla
Salva