2018-07-15 14:50:38 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { translate } from '../../../base/i18n';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2018-07-16 16:36:32 +00:00
|
|
|
import { AbstractButton } from '../../../base/toolbox';
|
2018-07-15 14:50:38 +00:00
|
|
|
import type { AbstractButtonProps } from '../../../base/toolbox';
|
|
|
|
|
|
|
|
import { incomingCallAnswered } from '../actions';
|
|
|
|
|
2018-07-16 16:36:32 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link AnswerButton}.
|
|
|
|
*/
|
2018-07-15 14:50:38 +00:00
|
|
|
type Props = AbstractButtonProps & {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The redux {@code dispatch} function.
|
|
|
|
*/
|
|
|
|
dispatch: Function
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2018-07-16 16:36:32 +00:00
|
|
|
* An implementation of a button which accepts/answers an incoming call.
|
2018-07-15 14:50:38 +00:00
|
|
|
*/
|
|
|
|
class AnswerButton extends AbstractButton<Props, *> {
|
|
|
|
accessibilityLabel = 'incomingCall.answer';
|
|
|
|
iconName = 'hangup';
|
|
|
|
label = 'incomingCall.answer';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles clicking / pressing the button, and answers the incoming call.
|
|
|
|
*
|
|
|
|
* @protected
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_handleClick() {
|
|
|
|
this.props.dispatch(incomingCallAnswered());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect()(AnswerButton));
|