您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HangupButton.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
  25. label = 'toolbar.hangup';
  26. tooltip = 'toolbar.hangup';
  27. /**
  28. * Helper function to perform the actual hangup action.
  29. *
  30. * @override
  31. * @protected
  32. * @returns {void}
  33. */
  34. _doHangup() {
  35. sendAnalytics(createToolbarEvent('hangup'));
  36. // FIXME: these should be unified.
  37. if (navigator.product === 'ReactNative') {
  38. this.props.dispatch(appNavigate(undefined));
  39. } else {
  40. this.props.dispatch(disconnect(true));
  41. }
  42. }
  43. }
  44. export default translate(connect()(HangupButton));