Bläddra i källkod

feat(replace-participant): Add replaceParticipant feature-flag

j8
tmoldovan8x8 3 år sedan
förälder
incheckning
0bd45a75d2
Inget konto är kopplat till bidragsgivarens mejladress

+ 3
- 3
conference.js Visa fil

@@ -45,6 +45,7 @@ import {
45 45
     p2pStatusChanged,
46 46
     sendLocalParticipant
47 47
 } from './react/features/base/conference';
48
+import { getReplaceParticipant } from './react/features/base/config/functions';
48 49
 import {
49 50
     checkAndNotifyForNewDevice,
50 51
     getAvailableDevices,
@@ -304,9 +305,8 @@ class ConferenceConnector {
304 305
 
305 306
         // not enough rights to create conference
306 307
         case JitsiConferenceErrors.AUTHENTICATION_REQUIRED: {
307
-            const { replaceParticipant }
308
-                = APP.store.getState()['features/base/config'];
309 308
 
309
+            const replaceParticipant = getReplaceParticipant(APP.store.getState());
310 310
 
311 311
             // Schedule reconnect to check if someone else created the room.
312 312
             this.reconnectTimeout = setTimeout(() => {
@@ -397,7 +397,7 @@ class ConferenceConnector {
397 397
      *
398 398
      */
399 399
     connect() {
400
-        const { replaceParticipant } = APP.store.getState()['features/base/config'];
400
+        const replaceParticipant = getReplaceParticipant(APP.store.getState());
401 401
 
402 402
         // the local storage overrides here and in connection.js can be used by jibri
403 403
         room.join(jitsiLocalStorage.getItem('xmpp_conference_password_override'), replaceParticipant);

+ 2
- 2
modules/UI/authentication/AuthHandler.js Visa fil

@@ -11,6 +11,7 @@ import {
11 11
     isTokenAuthEnabled,
12 12
     getTokenAuthUrl
13 13
 } from '../../../react/features/authentication/functions';
14
+import { getReplaceParticipant } from '../../../react/features/base/config/functions';
14 15
 import { isDialogOpen } from '../../../react/features/base/dialog';
15 16
 import { setJWT } from '../../../react/features/base/jwt';
16 17
 import UIUtil from '../util/UIUtil';
@@ -209,8 +210,7 @@ function logout(room: Object) {
209 210
     }).then(url => {
210 211
         // de-authenticate conference on the fly
211 212
         if (room.isJoined()) {
212
-            const { replaceParticipant }
213
-                = APP.store.getState()['features/base/config'];
213
+            const replaceParticipant = getReplaceParticipant(APP.store.getState());
214 214
 
215 215
             room.join(null, replaceParticipant);
216 216
         }

+ 5
- 3
react/features/base/conference/actions.js Visa fil

@@ -8,6 +8,7 @@ import {
8 8
 } from '../../analytics';
9 9
 import { getName } from '../../app/functions';
10 10
 import { endpointMessageReceived } from '../../subtitles';
11
+import { getReplaceParticipant } from '../config/functions';
11 12
 import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
12 13
 import { JitsiConferenceEvents } from '../lib-jitsi-meet';
13 14
 import { MEDIA_TYPE, setAudioMuted, setVideoMuted } from '../media';
@@ -460,7 +461,9 @@ export function createConference() {
460 461
 
461 462
         sendLocalParticipant(state, conference);
462 463
 
463
-        conference.join(password, config.replaceParticipant);
464
+        const replaceParticipant = getReplaceParticipant(state);
465
+
466
+        conference.join(password, replaceParticipant);
464 467
     };
465 468
 }
466 469
 
@@ -477,8 +480,7 @@ export function checkIfCanJoin() {
477 480
         const { authRequired, password }
478 481
             = getState()['features/base/conference'];
479 482
 
480
-        const { replaceParticipant }
481
-            = getState()['features/base/config'];
483
+        const replaceParticipant = getReplaceParticipant(APP.store.getState());
482 484
 
483 485
         authRequired && dispatch(_conferenceWillJoin(authRequired));
484 486
         authRequired && authRequired.join(password, replaceParticipant);

+ 12
- 0
react/features/base/config/functions.native.js Visa fil

@@ -2,6 +2,8 @@
2 2
 
3 3
 import { NativeModules } from 'react-native';
4 4
 
5
+import { getFeatureFlag, REPLACE_PARTICIPANT } from '../flags';
6
+
5 7
 export * from './functions.any';
6 8
 
7 9
 /**
@@ -19,3 +21,13 @@ export function _cleanupConfig(config: Object) {
19 21
         delete config.callStatsSecret;
20 22
     }
21 23
 }
24
+
25
+/**
26
+ * Returns the replaceParticipant config.
27
+ *
28
+ * @param {Object} state - The state of the app.
29
+ * @returns {boolean}
30
+ */
31
+export function getReplaceParticipant(state: Object): string {
32
+    return getFeatureFlag(state, REPLACE_PARTICIPANT, false);
33
+}

+ 10
- 0
react/features/base/config/functions.web.js Visa fil

@@ -33,6 +33,16 @@ export function getDialOutUrl(state: Object): string {
33 33
     return state['features/base/config'].guestDialOutUrl;
34 34
 }
35 35
 
36
+/**
37
+ * Returns the replaceParticipant config.
38
+ *
39
+ * @param {Object} state - The state of the app.
40
+ * @returns {boolean}
41
+ */
42
+export function getReplaceParticipant(state: Object): string {
43
+    return state['features/base/config'].replaceParticipant;
44
+}
45
+
36 46
 /**
37 47
  * Returns the list of enabled toolbar buttons.
38 48
  *

+ 6
- 0
react/features/base/flags/constants.js Visa fil

@@ -154,6 +154,12 @@ export const RAISE_HAND_ENABLED = 'raise-hand.enabled';
154 154
  */
155 155
 export const RECORDING_ENABLED = 'recording.enabled';
156 156
 
157
+/**
158
+ * Flag indicating if the user should join the conference with the replaceParticipant functionality.
159
+ * Default: (false).
160
+ */
161
+export const REPLACE_PARTICIPANT = 'replace.participant';
162
+
157 163
 /**
158 164
  * Flag indicating the local and (maximum) remote video resolution. Overrides
159 165
  * the server configuration.

Laddar…
Avbryt
Spara