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.

WaitForOwnerDialog.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // @flow
  2. import React, { Component } from 'react';
  3. import type { Dispatch } from 'redux';
  4. import { ConfirmDialog } from '../../../base/dialog';
  5. import { translate } from '../../../base/i18n';
  6. import { connect } from '../../../base/redux';
  7. import { openLoginDialog, cancelWaitForOwner } from '../../actions.native';
  8. /**
  9. * The type of the React {@code Component} props of {@link WaitForOwnerDialog}.
  10. */
  11. type Props = {
  12. /**
  13. * Redux store dispatch function.
  14. */
  15. dispatch: Dispatch<any>,
  16. /**
  17. * Invoked to obtain translated strings.
  18. */
  19. t: Function
  20. };
  21. /**
  22. * The dialog is display in XMPP password + guest access configuration, after
  23. * user connects from anonymous domain and the conference does not exist yet.
  24. *
  25. * See {@link LoginDialog} description for more details.
  26. */
  27. class WaitForOwnerDialog extends Component<Props> {
  28. /**
  29. * Initializes a new WaitForWonderDialog instance.
  30. *
  31. * @param {Object} props - The read-only properties with which the new
  32. * instance is to be initialized.
  33. */
  34. constructor(props) {
  35. super(props);
  36. // Bind event handlers so they are only bound once per instance.
  37. this._onCancel = this._onCancel.bind(this);
  38. this._onLogin = this._onLogin.bind(this);
  39. }
  40. /**
  41. * Implements React's {@link Component#render()}.
  42. *
  43. * @inheritdoc
  44. * @returns {ReactElement}
  45. */
  46. render() {
  47. return (
  48. <ConfirmDialog
  49. cancelLabel = 'dialog.Cancel'
  50. confirmLabel = 'dialog.IamHost'
  51. descriptionKey = 'dialog.WaitForHostMsg'
  52. onCancel = { this._onCancel }
  53. onSubmit = { this._onLogin } />
  54. );
  55. }
  56. _onCancel: () => void;
  57. /**
  58. * Called when the cancel button is clicked.
  59. *
  60. * @private
  61. * @returns {void}
  62. */
  63. _onCancel() {
  64. this.props.dispatch(cancelWaitForOwner());
  65. }
  66. _onLogin: () => void;
  67. /**
  68. * Called when the OK button is clicked.
  69. *
  70. * @private
  71. * @returns {void}
  72. */
  73. _onLogin() {
  74. this.props.dispatch(openLoginDialog());
  75. }
  76. }
  77. export default translate(connect()(WaitForOwnerDialog));