Browse Source

feat(mobile) adds more feature flags (#8450)

Features flags added:  
-tile-view.enabled
-filmstrip.enabled
-notifications.enabled
-toolbox.enabled
master
tmoldovan8x8 4 years ago
parent
commit
6a6aeb1d95
No account linked to committer's email address

+ 19
- 0
react/features/base/flags/constants.js View File

@@ -37,6 +37,12 @@ export const CONFERENCE_TIMER_ENABLED = 'conference-timer.enabled';
37 37
  */
38 38
 export const CHAT_ENABLED = 'chat.enabled';
39 39
 
40
+/**
41
+ * Flag indicating if the filmstrip should be enabled.
42
+ * Default: enabled (true).
43
+ */
44
+export const FILMSTRIP_ENABLED = 'filmstrip.enabled';
45
+
40 46
 /**
41 47
  * Flag indicating if invite functionality should be enabled.
42 48
  * Default: enabled (true).
@@ -75,6 +81,13 @@ export const MEETING_NAME_ENABLED = 'meeting-name.enabled';
75 81
  */
76 82
 export const MEETING_PASSWORD_ENABLED = 'meeting-password.enabled';
77 83
 
84
+
85
+/**
86
+ * Flag indicating if the notifications should be enabled.
87
+ * Default: enabled (true).
88
+ */
89
+export const NOTIFICATIONS_ENABLED = 'notifications.enabled';
90
+
78 91
 /**
79 92
  * Flag indicating if Picture-in-Picture should be enabled.
80 93
  * Default: auto-detected.
@@ -118,6 +131,12 @@ export const TILE_VIEW_ENABLED = 'tile-view.enabled';
118 131
  */
119 132
 export const TOOLBOX_ALWAYS_VISIBLE = 'toolbox.alwaysVisible';
120 133
 
134
+/**
135
+ * Flag indicating if the toolbox should be enabled
136
+ * Default: enabled.
137
+ */
138
+export const TOOLBOX_ENABLED = 'toolbox.enabled';
139
+
121 140
 /**
122 141
  * Flag indicating if the video share button should be enabled
123 142
  * Default: enabled (true).

+ 8
- 0
react/features/filmstrip/functions.native.js View File

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { getFeatureFlag, FILMSTRIP_ENABLED } from '../base/flags';
3 4
 import { toState } from '../base/redux';
4 5
 
5 6
 /**
@@ -14,6 +15,13 @@ import { toState } from '../base/redux';
14 15
  */
15 16
 export function isFilmstripVisible(stateful: Object | Function) {
16 17
     const state = toState(stateful);
18
+
19
+    const enabled = getFeatureFlag(state, FILMSTRIP_ENABLED, true);
20
+
21
+    if (!enabled) {
22
+        return false;
23
+    }
24
+
17 25
     const { length: participantCount } = state['features/base/participants'];
18 26
 
19 27
     return participantCount > 1;

+ 8
- 3
react/features/notifications/actions.js View File

@@ -3,6 +3,8 @@
3 3
 import throttle from 'lodash/throttle';
4 4
 import type { Dispatch } from 'redux';
5 5
 
6
+import { NOTIFICATIONS_ENABLED, getFeatureFlag } from '../base/flags';
7
+
6 8
 import {
7 9
     CLEAR_NOTIFICATIONS,
8 10
     HIDE_NOTIFICATION,
@@ -81,9 +83,12 @@ export function showErrorNotification(props: Object) {
81 83
 export function showNotification(props: Object = {}, timeout: ?number) {
82 84
     return function(dispatch: Function, getState: Function) {
83 85
         const { notifications } = getState()['features/base/config'];
84
-        const shouldDisplay = !notifications
85
-            || notifications.includes(props.descriptionKey)
86
-            || notifications.includes(props.titleKey);
86
+        const enabledFlag = getFeatureFlag(getState(), NOTIFICATIONS_ENABLED, true);
87
+
88
+        const shouldDisplay = enabledFlag
89
+            && (!notifications
90
+                || notifications.includes(props.descriptionKey)
91
+                || notifications.includes(props.titleKey));
87 92
 
88 93
         if (shouldDisplay) {
89 94
             return dispatch({

+ 4
- 3
react/features/toolbox/functions.native.js View File

@@ -1,7 +1,7 @@
1 1
 // @flow
2 2
 
3 3
 import { hasAvailableDevices } from '../base/devices';
4
-import { TOOLBOX_ALWAYS_VISIBLE, getFeatureFlag } from '../base/flags';
4
+import { TOOLBOX_ALWAYS_VISIBLE, getFeatureFlag, TOOLBOX_ENABLED } from '../base/flags';
5 5
 import { toState } from '../base/redux';
6 6
 import { isLocalVideoTrackDesktop } from '../base/tracks';
7 7
 
@@ -16,9 +16,10 @@ export function isToolboxVisible(stateful: Object | Function) {
16 16
     const state = toState(stateful);
17 17
     const { alwaysVisible, enabled, visible } = state['features/toolbox'];
18 18
     const { length: participantCount } = state['features/base/participants'];
19
-    const flag = getFeatureFlag(state, TOOLBOX_ALWAYS_VISIBLE, false);
19
+    const alwaysVisibleFlag = getFeatureFlag(state, TOOLBOX_ALWAYS_VISIBLE, false);
20
+    const enabledFlag = getFeatureFlag(state, TOOLBOX_ENABLED, true);
20 21
 
21
-    return enabled && (alwaysVisible || visible || participantCount === 1 || flag);
22
+    return enabledFlag && enabled && (alwaysVisible || visible || participantCount === 1 || alwaysVisibleFlag);
22 23
 }
23 24
 
24 25
 /**

+ 3
- 1
react/features/video-layout/functions.js View File

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { getFeatureFlag, TILE_VIEW_ENABLED } from '../base/flags';
3 4
 import { getPinnedParticipant, getParticipantCount } from '../base/participants';
4 5
 import { isYoutubeVideoPlaying } from '../youtube-player/functions';
5 6
 
@@ -82,9 +83,10 @@ export function shouldDisplayTileView(state: Object = {}) {
82 83
         return false;
83 84
     }
84 85
 
86
+    const tileViewEnabledFeatureFlag = getFeatureFlag(state, TILE_VIEW_ENABLED, true);
85 87
     const { disableTileView } = state['features/base/config'];
86 88
 
87
-    if (disableTileView) {
89
+    if (disableTileView || !tileViewEnabledFeatureFlag) {
88 90
         return false;
89 91
     }
90 92
 

Loading…
Cancel
Save