Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

Saúl Ibarra Corretgé955b24be9d9f
diff --git a/react/features/base/flags/constants.js b/react/features/base/flags/constants.js
index 41187a07b3..e5d122e775 100644
--- a/react/features/base/flags/constants.js
+++ b/react/features/base/flags/constants.js
@@ -13,6 +13,12 @@ export const CALENDAR_ENABLED = 'calendar.enabled';
*/
export const CALL_INTEGRATION_ENABLED = 'call-integration.enabled';
+/**
+ * Flag indicating if chat should be enabled.
+ * Default: enabled (true).
+ */
+export const CLOSE_CAPTIONS_ENABLED = 'close-captions.enabled';
+
/**
* Flag indicating if chat should be enabled.
* Default: enabled (true).
diff --git a/react/features/subtitles/components/ClosedCaptionButton.native.js b/react/features/subtitles/components/ClosedCaptionButton.native.js
index 7be1d19dcb..b0887fe22c 100644
--- a/react/features/subtitles/components/ClosedCaptionButton.native.js
+++ b/react/features/subtitles/components/ClosedCaptionButton.native.js
@@ -1,5 +1,6 @@
// @flow
+import { getFeatureFlag, CLOSE_CAPTIONS_ENABLED } from '../../base/flags';
import { translate } from '../../base/i18n';
import { IconClosedCaption } from '../../base/icons';
import { connect } from '../../base/redux';
@@ -20,5 +21,24 @@ class ClosedCaptionButton
toggledLabel = 'transcribing.stop';
}
-export default translate(connect(_abstractMapStateToProps)(
- ClosedCaptionButton));
+/**
+ * Maps (parts of) the redux state to the associated props for this component.
+ *
+ * @param {Object} state - The redux state.
+ * @param {Object} ownProps - The properties explicitly passed to the component
+ * instance.
+ * @private
+ * @returns {Props}
+ */
+export function mapStateToProps(state: Object, ownProps: Object) {
+ const { transcribingEnabled } = state['features/base/config'];
+ const enabled = getFeatureFlag(state, CLOSE_CAPTIONS_ENABLED, true) && transcribingEnabled;
+ const { visible = enabled } = ownProps;
+
+ return {
+ ..._abstractMapStateToProps(state, ownProps),
+ visible
+ };
+}
+
+export default translate(connect(mapStateToProps)(ClosedCaptionButton));
diff --git a/react/features/subtitles/components/ClosedCaptionButton.web.js b/react/features/subtitles/components/ClosedCaptionButton.web.js
index 482d548aab..9e761837f9 100644
--- a/react/features/subtitles/components/ClosedCaptionButton.web.js
+++ b/react/features/subtitles/components/ClosedCaptionButton.web.js
@@ -22,5 +22,4 @@ class ClosedCaptionButton
toggledLabel = 'toolbar.stopSubtitles';
}
-export default translate(connect(_abstractMapStateToProps)(
- ClosedCaptionButton));
+export default translate(connect(_abstractMapStateToProps)(ClosedCaptionButton));