Bläddra i källkod

fix(RN): show the CC button only when transcribing is available

j8
paweldomas 6 år sedan
förälder
incheckning
ee9f304345

+ 12
- 3
react/features/subtitles/components/AbstractClosedCaptionButton.js Visa fil

@@ -74,15 +74,24 @@ export class AbstractClosedCaptionButton
74 74
  * {@code AbstractClosedCaptionButton} component.
75 75
  *
76 76
  * @param {Object} state - The redux state.
77
+ * @param {Object} ownProps - The properties explicitly passed to the component
78
+ * instance.
77 79
  * @private
78 80
  * @returns {{
79
- *     __requestingSubtitles: boolean
81
+ *     _requestingSubtitles: boolean,
82
+ *     visible: boolean
80 83
  * }}
81 84
  */
82
-export function _abstractMapStateToProps(state: Object) {
85
+export function _abstractMapStateToProps(state: Object, ownProps: Object) {
83 86
     const { _requestingSubtitles } = state['features/subtitles'];
87
+    const { transcribingEnabled } = state['features/base/config'];
88
+
89
+    // Default 'visible' to 'transcribingEnabled' if not explicitly specified
90
+    // in the component's properties.
91
+    const { visible = transcribingEnabled } = ownProps;
84 92
 
85 93
     return {
86
-        _requestingSubtitles
94
+        _requestingSubtitles,
95
+        visible
87 96
     };
88 97
 }

+ 2
- 14
react/features/toolbox/components/web/Toolbox.js Visa fil

@@ -157,17 +157,11 @@ type Props = {
157 157
      */
158 158
     _sharingVideo: boolean,
159 159
 
160
-    /**
161
-     * Whether or not transcribing is enabled.
162
-     */
163
-    _transcribingEnabled: boolean,
164
-
165 160
     /**
166 161
      * Flag showing whether toolbar is visible.
167 162
      */
168 163
     _visible: boolean,
169 164
 
170
-
171 165
     /**
172 166
      * Set with the buttons which this Toolbox should display.
173 167
      */
@@ -323,7 +317,6 @@ class Toolbox extends Component<Props> {
323 317
             _chatOpen,
324 318
             _hideInviteButton,
325 319
             _overflowMenuVisible,
326
-            _transcribingEnabled,
327 320
             _raisedHand,
328 321
             _visible,
329 322
             _visibleButtons,
@@ -367,9 +360,8 @@ class Toolbox extends Component<Props> {
367 360
                             <ChatCounter />
368 361
                         </div> }
369 362
                     {
370
-                        _transcribingEnabled
371
-                        && this._shouldShowButton('closedcaptions')
372
-                        && <ClosedCaptionButton />
363
+                        this._shouldShowButton('closedcaptions')
364
+                            && <ClosedCaptionButton />
373 365
                     }
374 366
                 </div>
375 367
                 <div className = 'button-group-center'>
@@ -1039,9 +1031,6 @@ function _mapStateToProps(state) {
1039 1031
         callStatsID,
1040 1032
         iAmRecorder
1041 1033
     } = state['features/base/config'];
1042
-    const {
1043
-        transcribingEnabled
1044
-    } = state['features/base/config'];
1045 1034
     const sharedVideoStatus = state['features/shared-video'].status;
1046 1035
     const { current } = state['features/side-panel'];
1047 1036
     const {
@@ -1094,7 +1083,6 @@ function _mapStateToProps(state) {
1094 1083
         _overflowMenuVisible: overflowMenuVisible,
1095 1084
         _raisedHand: localParticipant.raisedHand,
1096 1085
         _screensharing: localVideo && localVideo.videoType === 'desktop',
1097
-        _transcribingEnabled: transcribingEnabled,
1098 1086
         _sharingVideo: sharedVideoStatus === 'playing'
1099 1087
             || sharedVideoStatus === 'start'
1100 1088
             || sharedVideoStatus === 'pause',

Laddar…
Avbryt
Spara