Przeglądaj źródła

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

master
Saúl Ibarra Corretgé 5 lat temu
rodzic
commit
955b24be9d

+ 6
- 0
react/features/base/flags/constants.js Wyświetl plik

@@ -13,6 +13,12 @@ export const CALENDAR_ENABLED = 'calendar.enabled';
13 13
  */
14 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 23
  * Flag indicating if chat should be enabled.
18 24
  * Default: enabled (true).

+ 22
- 2
react/features/subtitles/components/ClosedCaptionButton.native.js Wyświetl plik

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { getFeatureFlag, CLOSE_CAPTIONS_ENABLED } from '../../base/flags';
3 4
 import { translate } from '../../base/i18n';
4 5
 import { IconClosedCaption } from '../../base/icons';
5 6
 import { connect } from '../../base/redux';
@@ -20,5 +21,24 @@ class ClosedCaptionButton
20 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 Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz