2022-07-28 07:28:29 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2022-11-07 12:00:46 +00:00
|
|
|
|
|
|
|
import { IReduxState } from '../../../../app/types';
|
2022-11-08 10:24:32 +00:00
|
|
|
import { translate } from '../../../../base/i18n/functions';
|
|
|
|
import { IconGear } from '../../../../base/icons/svg';
|
2022-07-28 07:28:29 +00:00
|
|
|
// @ts-ignore
|
|
|
|
import { AbstractButton, type AbstractButtonProps } from '../../../../base/toolbox/components';
|
|
|
|
import { navigate }
|
|
|
|
// @ts-ignore
|
|
|
|
from '../../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
|
|
|
|
// @ts-ignore
|
|
|
|
import { screen } from '../../../../mobile/navigation/routes';
|
2022-11-28 10:52:45 +00:00
|
|
|
import { SETTINGS_ENABLED } from '../../../flags/constants';
|
|
|
|
import { getFeatureFlag } from '../../../flags/functions';
|
2022-11-07 12:00:46 +00:00
|
|
|
import { connect } from '../../../redux/functions';
|
2022-07-28 07:28:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements an {@link AbstractButton} to open the carmode.
|
|
|
|
*/
|
|
|
|
class SettingsButton extends AbstractButton<AbstractButtonProps, any, any> {
|
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.Settings';
|
2022-11-08 10:24:32 +00:00
|
|
|
icon = IconGear;
|
2022-07-28 07:28:29 +00:00
|
|
|
label = 'settings.buttonLabel';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles clicking / pressing the button, and opens the carmode mode.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_handleClick() {
|
|
|
|
return navigate(screen.settings.main);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-07 12:00:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the redux state to the component's props.
|
|
|
|
*
|
|
|
|
* @param {IReduxState} state - The Redux state.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state: IReduxState) {
|
|
|
|
const enabled = getFeatureFlag(state, SETTINGS_ENABLED, true);
|
|
|
|
|
|
|
|
return {
|
|
|
|
visible: enabled
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-08-08 09:36:06 +00:00
|
|
|
// @ts-ignore
|
2022-11-07 12:00:46 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(SettingsButton));
|