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