Browse Source

rn,flags: add flag to show/hide video share button

master
utkarshmarwaha 5 years ago
parent
commit
7f5751b918
No account linked to committer's email address

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

@@ -112,6 +112,12 @@ export const TILE_VIEW_ENABLED = 'tile-view.enabled';
112 112
  */
113 113
 export const TOOLBOX_ALWAYS_VISIBLE = 'toolbox.alwaysVisible';
114 114
 
115
+/**
116
+ * Flag indicating if the video share button should be enabled
117
+ * Default: enabled (true).
118
+ */
119
+export const VIDEO_SHARE_BUTTON_ENABLED = 'video-share.enabled';
120
+
115 121
 /**
116 122
  * Flag indicating if the welcome page should be enabled.
117 123
  * Default: disabled (false).

+ 9
- 3
react/features/youtube-player/components/VideoShareButton.js View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 import type { Dispatch } from 'redux';
4 4
 
5
+import { getFeatureFlag, VIDEO_SHARE_BUTTON_ENABLED } from '../../base/flags';
5 6
 import { translate } from '../../base/i18n';
6 7
 import { IconShareVideo } from '../../base/icons';
7 8
 import { getLocalParticipant } from '../../base/participants';
@@ -90,21 +91,26 @@ class VideoShareButton extends AbstractButton<Props, *> {
90 91
  * Maps part of the Redux state to the props of this component.
91 92
  *
92 93
  * @param {Object} state - The Redux state.
94
+ * @param {Object} ownProps - The properties explicitly passed to the component instance.
93 95
  * @private
94 96
  * @returns {Props}
95 97
  */
96
-function _mapStateToProps(state): Object {
98
+function _mapStateToProps(state, ownProps): Object {
97 99
     const { ownerId, status: sharedVideoStatus } = state['features/youtube-player'];
98 100
     const localParticipantId = getLocalParticipant(state).id;
101
+    const enabled = getFeatureFlag(state, VIDEO_SHARE_BUTTON_ENABLED, true);
102
+    const { visible = enabled } = ownProps;
99 103
 
100 104
     if (ownerId !== localParticipantId) {
101 105
         return {
102 106
             _isDisabled: isSharingStatus(sharedVideoStatus),
103
-            _sharingVideo: false };
107
+            _sharingVideo: false,
108
+            visible };
104 109
     }
105 110
 
106 111
     return {
107
-        _sharingVideo: isSharingStatus(sharedVideoStatus)
112
+        _sharingVideo: isSharingStatus(sharedVideoStatus),
113
+        visible
108 114
     };
109 115
 }
110 116
 

Loading…
Cancel
Save