You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HangupButton.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @flow
  2. import { connect } from 'react-redux';
  3. import { createToolbarEvent, sendAnalytics } from '../../analytics';
  4. import { appNavigate } from '../../app';
  5. import { disconnect } from '../../base/connection';
  6. import { translate } from '../../base/i18n';
  7. import { AbstractHangupButton } from '../../base/toolbox';
  8. import type { AbstractButtonProps } from '../../base/toolbox';
  9. type Props = AbstractButtonProps & {
  10. /**
  11. * The redux {@code dispatch} function.
  12. */
  13. dispatch: Function
  14. }
  15. /**
  16. * Component that renders a toolbar button for leaving the current conference.
  17. *
  18. * @extends AbstractHangupButton
  19. */
  20. class HangupButton extends AbstractHangupButton<Props, *> {
  21. label = 'toolbar.hangup';
  22. tooltip = 'toolbar.hangup';
  23. /**
  24. * Helper function to perform the actual hangup action.
  25. *
  26. * @override
  27. * @private
  28. * @returns {void}
  29. */
  30. _doHangup() {
  31. sendAnalytics(createToolbarEvent('hangup'));
  32. // FIXME: these should be unified.
  33. if (navigator.product === 'ReactNative') {
  34. this.props.dispatch(appNavigate(undefined));
  35. } else {
  36. this.props.dispatch(disconnect(true));
  37. }
  38. }
  39. }
  40. export default translate(connect()(HangupButton));