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

RoomLockPrompt.native.js 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { Dialog } from '../../base/dialog';
  4. import { endRoomLockRequest } from '../actions';
  5. /**
  6. * Implements a React Component which prompts the user for a password to lock a
  7. * conference/room.
  8. */
  9. class RoomLockPrompt extends Component {
  10. /**
  11. * RoomLockPrompt component's property types.
  12. *
  13. * @static
  14. */
  15. static propTypes = {
  16. /**
  17. * The JitsiConference which requires a password.
  18. *
  19. * @type {JitsiConference}
  20. */
  21. conference: React.PropTypes.object,
  22. dispatch: React.PropTypes.func
  23. }
  24. /**
  25. * Initializes a new RoomLockPrompt instance.
  26. *
  27. * @param {Object} props - The read-only properties with which the new
  28. * instance is to be initialized.
  29. */
  30. constructor(props) {
  31. super(props);
  32. // Bind event handlers so they are only bound once for every instance.
  33. this._onCancel = this._onCancel.bind(this);
  34. this._onSubmit = this._onSubmit.bind(this);
  35. }
  36. /**
  37. * Implements React's {@link Component#render()}.
  38. *
  39. * @inheritdoc
  40. * @returns {ReactElement}
  41. */
  42. render() {
  43. return (
  44. <Dialog
  45. bodyKey = 'dialog.passwordLabel'
  46. onCancel = { this._onCancel }
  47. onSubmit = { this._onSubmit }
  48. titleKey = 'toolbar.lock' />
  49. );
  50. }
  51. /**
  52. * Notifies this prompt that it has been dismissed by cancel.
  53. *
  54. * @private
  55. * @returns {boolean} whether to hide the dialog
  56. */
  57. _onCancel() {
  58. // An undefined password is understood to cancel the request to lock the
  59. // conference/room.
  60. return this._onSubmit(undefined);
  61. }
  62. /**
  63. * Notifies this prompt that it has been dismissed by submitting a specific
  64. * value.
  65. *
  66. * @param {string} value - The submitted value.
  67. * @private
  68. * @returns {boolean} returns false, we do not want to hide dialog as this
  69. * will be handled inside endRoomLockRequest after setting password is
  70. * resolved.
  71. */
  72. _onSubmit(value) {
  73. this.props.dispatch(endRoomLockRequest(this.props.conference, value));
  74. // do not hide
  75. return false;
  76. }
  77. }
  78. export default connect()(RoomLockPrompt);