Selaa lähdekoodia

rn,cc: add feature-flag to disable close captions

master
Saúl Ibarra Corretgé 5 vuotta sitten
vanhempi
commit
955b24be9d

+ 6
- 0
react/features/base/flags/constants.js Näytä tiedosto

13
  */
13
  */
14
 export const CALL_INTEGRATION_ENABLED = 'call-integration.enabled';
14
 export const CALL_INTEGRATION_ENABLED = 'call-integration.enabled';
15
 
15
 
16
+/**
17
+ * Flag indicating if chat should be enabled.
18
+ * Default: enabled (true).
19
+ */
20
+export const CLOSE_CAPTIONS_ENABLED = 'close-captions.enabled';
21
+
16
 /**
22
 /**
17
  * Flag indicating if chat should be enabled.
23
  * Flag indicating if chat should be enabled.
18
  * Default: enabled (true).
24
  * Default: enabled (true).

+ 22
- 2
react/features/subtitles/components/ClosedCaptionButton.native.js Näytä tiedosto

1
 // @flow
1
 // @flow
2
 
2
 
3
+import { getFeatureFlag, CLOSE_CAPTIONS_ENABLED } from '../../base/flags';
3
 import { translate } from '../../base/i18n';
4
 import { translate } from '../../base/i18n';
4
 import { IconClosedCaption } from '../../base/icons';
5
 import { IconClosedCaption } from '../../base/icons';
5
 import { connect } from '../../base/redux';
6
 import { connect } from '../../base/redux';
20
     toggledLabel = 'transcribing.stop';
21
     toggledLabel = 'transcribing.stop';
21
 }
22
 }
22
 
23
 
23
-export default translate(connect(_abstractMapStateToProps)(
24
-    ClosedCaptionButton));
24
+/**
25
+ * Maps (parts of) the redux state to the associated props for this component.
26
+ *
27
+ * @param {Object} state - The redux state.
28
+ * @param {Object} ownProps - The properties explicitly passed to the component
29
+ * instance.
30
+ * @private
31
+ * @returns {Props}
32
+ */
33
+export function mapStateToProps(state: Object, ownProps: Object) {
34
+    const { transcribingEnabled } = state['features/base/config'];
35
+    const enabled = getFeatureFlag(state, CLOSE_CAPTIONS_ENABLED, true) && transcribingEnabled;
36
+    const { visible = enabled } = ownProps;
37
+
38
+    return {
39
+        ..._abstractMapStateToProps(state, ownProps),
40
+        visible
41
+    };
42
+}
43
+
44
+export default translate(connect(mapStateToProps)(ClosedCaptionButton));

+ 1
- 2
react/features/subtitles/components/ClosedCaptionButton.web.js Näytä tiedosto

22
     toggledLabel = 'toolbar.stopSubtitles';
22
     toggledLabel = 'toolbar.stopSubtitles';
23
 }
23
 }
24
 
24
 
25
-export default translate(connect(_abstractMapStateToProps)(
26
-    ClosedCaptionButton));
25
+export default translate(connect(_abstractMapStateToProps)(ClosedCaptionButton));

Loading…
Peruuta
Tallenna