feat(flags) add feature flag for audio-only button

This commit is contained in:
trippledave 2021-03-19 08:17:37 +01:00 committed by GitHub
parent 5b21051c6b
commit 68c2c9be40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -19,6 +19,12 @@ export const AUDIO_FOCUS_DISABLED = 'audio-focus.disabled';
*/ */
export const AUDIO_MUTE_BUTTON_ENABLED = 'audio-mute.enabled'; export const AUDIO_MUTE_BUTTON_ENABLED = 'audio-mute.enabled';
/**
* Flag indicating that the Audio only button in the overflow menu is enabled.
* Default: enabled (true).
*/
export const AUDIO_ONLY_BUTTON_ENABLED = 'audio-only.enabled';
/** /**
* Flag indicating if calendar integration should be enabled. * Flag indicating if calendar integration should be enabled.
* Default: enabled (true) on Android, auto-detected on iOS. * Default: enabled (true) on Android, auto-detected on iOS.

View File

@ -1,6 +1,7 @@
// @flow // @flow
import { toggleAudioOnly } from '../../../base/audio-only'; import { toggleAudioOnly } from '../../../base/audio-only';
import { AUDIO_ONLY_BUTTON_ENABLED, getFeatureFlag } from '../../../base/flags';
import { translate } from '../../../base/i18n'; import { translate } from '../../../base/i18n';
import { IconAudioOnly, IconAudioOnlyOff } from '../../../base/icons'; import { IconAudioOnly, IconAudioOnlyOff } from '../../../base/icons';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
@ -60,16 +61,20 @@ class AudioOnlyButton extends AbstractButton<Props, *> {
* {@code AudioOnlyButton} component. * {@code AudioOnlyButton} component.
* *
* @param {Object} state - The Redux state. * @param {Object} state - The Redux state.
* @param {Object} ownProps - The properties explicitly passed to the component instance.
* @private * @private
* @returns {{ * @returns {{
* _audioOnly: boolean * _audioOnly: boolean
* }} * }}
*/ */
function _mapStateToProps(state): Object { function _mapStateToProps(state, ownProps): Object {
const { enabled: audioOnly } = state['features/base/audio-only']; const { enabled: audioOnly } = state['features/base/audio-only'];
const enabledInFeatureFlags = getFeatureFlag(state, AUDIO_ONLY_BUTTON_ENABLED, true);
const { visible = enabledInFeatureFlags } = ownProps;
return { return {
_audioOnly: Boolean(audioOnly) _audioOnly: Boolean(audioOnly),
visible
}; };
} }