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

This commit is contained in:
Saúl Ibarra Corretgé 2020-04-01 13:08:02 +02:00 committed by Saúl Ibarra Corretgé
parent de6c7e0117
commit 955b24be9d
3 changed files with 29 additions and 4 deletions

View File

@ -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).

View File

@ -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));

View File

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