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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. /**
  10. * The type of the React {@code Component} props of {@link HangupButton}.
  11. */
  12. type Props = AbstractButtonProps & {
  13. /**
  14. * The redux {@code dispatch} function.
  15. */
  16. dispatch: Function
  17. };
  18. /**
  19. * Component that renders a toolbar button for leaving the current conference.
  20. *
  21. * @extends AbstractHangupButton
  22. */
  23. class HangupButton extends AbstractHangupButton<Props, *> {
  24. label = 'toolbar.hangup';
  25. tooltip = 'toolbar.hangup';
  26. /**
  27. * Helper function to perform the actual hangup action.
  28. *
  29. * @override
  30. * @protected
  31. * @returns {void}
  32. */
  33. _doHangup() {
  34. sendAnalytics(createToolbarEvent('hangup'));
  35. // FIXME: these should be unified.
  36. if (navigator.product === 'ReactNative') {
  37. this.props.dispatch(appNavigate(undefined));
  38. } else {
  39. this.props.dispatch(disconnect(true));
  40. }
  41. }
  42. }
  43. export default translate(connect()(HangupButton));