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.

ShareScreenWarningDialog.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // @flow
  2. import React, { Component } from 'react';
  3. import type { Dispatch } from 'redux';
  4. import { Dialog } from '../../base/dialog';
  5. import { translate } from '../../base/i18n';
  6. import { connect } from '../../base/redux';
  7. import { toggleScreensharing } from '../../base/tracks';
  8. export type Props = {
  9. /**
  10. * The redux {@code dispatch} function.
  11. */
  12. dispatch: Dispatch<any>,
  13. /**
  14. * Whether or not the dialog was opened for the audio screen sharing flow or the normal one.
  15. */
  16. _isAudioScreenShareWarning: Boolean,
  17. /**
  18. * Invoked to obtain translated strings.
  19. */
  20. t: Function
  21. }
  22. /**
  23. * Component that displays the share audio helper dialog.
  24. */
  25. class ShareScreenWarningDialog extends Component<Props> {
  26. /**
  27. * Instantiates a new component.
  28. *
  29. * @inheritdoc
  30. */
  31. constructor(props) {
  32. super(props);
  33. this._onStopSharing = this._onStopSharing.bind(this);
  34. }
  35. _onStopSharing: () => boolean;
  36. /**
  37. * Stop current screen sharing session.
  38. *
  39. * @returns {boolean}
  40. */
  41. _onStopSharing() {
  42. // Depending on the context from which this dialog is opened we'll either be toggling off an audio only
  43. // share session or a normal screen sharing one, this is indicated by the _isAudioScreenShareWarning prop.
  44. this.props.dispatch(toggleScreensharing(undefined,
  45. !this.props._isAudioScreenShareWarning));
  46. return true;
  47. }
  48. /**
  49. * Implements {@Component#render}.
  50. * @inheritdoc
  51. */
  52. render() {
  53. const { t } = this.props;
  54. let description1, description2, header1, header2, stopSharing, title;
  55. if (this.props._isAudioScreenShareWarning) {
  56. header1 = 'dialog.shareAudioWarningH1';
  57. header2 = 'dialog.shareMediaWarningGenericH2';
  58. description1 = 'dialog.shareAudioWarningD1';
  59. description2 = 'dialog.shareAudioWarningD2';
  60. title = 'dialog.shareAudioWarningTitle';
  61. stopSharing = 'toolbar.stopScreenSharing';
  62. } else {
  63. header1 = 'dialog.shareScreenWarningTitle';
  64. header2 = 'dialog.shareMediaWarningGenericH2';
  65. description1 = 'dialog.shareScreenWarningD1';
  66. description2 = 'dialog.shareScreenWarningD2';
  67. title = 'dialog.shareScreenWarningTitle';
  68. stopSharing = 'toolbar.stopAudioSharing';
  69. }
  70. return (<Dialog
  71. hideCancelButton = { false }
  72. okKey = { t(stopSharing) }
  73. onSubmit = { this._onStopSharing }
  74. titleKey = { t(title) }
  75. width = { 'small' }>
  76. <div className = 'share-screen-warn-dialog'>
  77. <p className = 'header'> { t(header1) } </p>
  78. <p className = 'description' > { t(description1) } </p>
  79. <div className = 'separator-line' />
  80. <p className = 'header' > { t(header2) } </p>
  81. <p className = 'description' > { t(description2) } </p>
  82. </div>
  83. </Dialog>);
  84. }
  85. }
  86. export default translate(connect()(ShareScreenWarningDialog));