2017-10-24 08:40:39 +00:00
|
|
|
// @flow
|
|
|
|
|
2018-05-10 23:01:55 +00:00
|
|
|
import { openDialog } from '../../../base/dialog';
|
|
|
|
import { translate } from '../../../base/i18n';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2018-05-10 23:01:55 +00:00
|
|
|
import { AbstractButton } from '../../../base/toolbox';
|
|
|
|
import type { AbstractButtonProps } from '../../../base/toolbox';
|
2017-10-24 08:40:39 +00:00
|
|
|
|
2018-05-10 23:01:55 +00:00
|
|
|
import AudioRoutePickerDialog from './AudioRoutePickerDialog';
|
2017-10-24 08:40:39 +00:00
|
|
|
|
|
|
|
|
2018-04-18 14:34:40 +00:00
|
|
|
type Props = AbstractButtonProps & {
|
2017-10-24 08:40:39 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-14 20:18:16 +00:00
|
|
|
* The redux {@code dispatch} function used to open/show the
|
|
|
|
* {@code AudioRoutePickerDialog}.
|
2017-10-24 08:40:39 +00:00
|
|
|
*/
|
2018-04-18 14:34:40 +00:00
|
|
|
dispatch: Function
|
2017-10-24 08:40:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A toolbar button which triggers an audio route picker when pressed.
|
|
|
|
*/
|
2018-04-18 14:34:40 +00:00
|
|
|
class AudioRouteButton extends AbstractButton<Props, *> {
|
2018-06-07 20:32:18 +00:00
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.audioRoute';
|
2018-04-18 14:34:40 +00:00
|
|
|
iconName = 'icon-volume';
|
|
|
|
label = 'toolbar.audioRoute';
|
|
|
|
|
2017-10-24 08:40:39 +00:00
|
|
|
/**
|
2018-04-18 14:34:40 +00:00
|
|
|
* Handles clicking / pressing the button, and opens the appropriate dialog.
|
2017-10-24 08:40:39 +00:00
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-04-18 14:34:40 +00:00
|
|
|
_handleClick() {
|
2019-08-09 10:41:52 +00:00
|
|
|
this.props.dispatch(openDialog(AudioRoutePickerDialog));
|
2017-10-24 08:40:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-18 14:34:40 +00:00
|
|
|
export default translate(connect()(AudioRouteButton));
|