|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+// @flow
|
|
|
2
|
+
|
|
1
|
3
|
import InlineDialog from '@atlaskit/inline-dialog';
|
|
2
|
|
-import PropTypes from 'prop-types';
|
|
3
|
4
|
import React, { Component } from 'react';
|
|
4
|
5
|
import { connect } from 'react-redux';
|
|
5
|
6
|
|
|
|
@@ -15,12 +16,65 @@ import { updateDialInNumbers } from '../actions';
|
|
15
|
16
|
import { InfoDialog } from './info-dialog';
|
|
16
|
17
|
|
|
17
|
18
|
/**
|
|
18
|
|
- * The amount of time, in milliseconds, to wait until automatically showing
|
|
19
|
|
- * the {@code InfoDialog}. This is essentially a hack as automatic showing
|
|
20
|
|
- * should happen in a lonely call and some time is needed to populate
|
|
21
|
|
- * participants already in the call.
|
|
|
19
|
+ * The type of the React {@code Component} props of {@link InfoDialogButton}.
|
|
22
|
20
|
*/
|
|
23
|
|
-const INFO_DIALOG_AUTO_SHOW_TIMEOUT = 1500;
|
|
|
21
|
+type Props = {
|
|
|
22
|
+
|
|
|
23
|
+ /**
|
|
|
24
|
+ * The redux state representing the dial-in numbers feature.
|
|
|
25
|
+ */
|
|
|
26
|
+ _dialIn: Object,
|
|
|
27
|
+
|
|
|
28
|
+ /**
|
|
|
29
|
+ * Whether or not the {@code InfoDialog} should display automatically when
|
|
|
30
|
+ * in a lonely call.
|
|
|
31
|
+ */
|
|
|
32
|
+ _disableAutoShow: boolean,
|
|
|
33
|
+
|
|
|
34
|
+ /**
|
|
|
35
|
+ * Whether or not the local participant has joined a
|
|
|
36
|
+ * {@code JitsiConference}. Used to trigger auto showing of the
|
|
|
37
|
+ * {@code InfoDialog}.
|
|
|
38
|
+ */
|
|
|
39
|
+ _isConferenceJoined: Boolean,
|
|
|
40
|
+
|
|
|
41
|
+ /**
|
|
|
42
|
+ * The URL for a currently active live broadcast
|
|
|
43
|
+ */
|
|
|
44
|
+ _liveStreamViewURL: ?string,
|
|
|
45
|
+
|
|
|
46
|
+ /**
|
|
|
47
|
+ * The number of real participants in the call. If in a lonely call, the
|
|
|
48
|
+ * {@code InfoDialog} will be automatically shown.
|
|
|
49
|
+ */
|
|
|
50
|
+ _participantCount: number,
|
|
|
51
|
+
|
|
|
52
|
+ /**
|
|
|
53
|
+ * Whether or not the toolbox, in which this component exists, is visible.
|
|
|
54
|
+ */
|
|
|
55
|
+ _toolboxVisible: boolean,
|
|
|
56
|
+
|
|
|
57
|
+ /**
|
|
|
58
|
+ * Invoked to toggle display of the info dialog.
|
|
|
59
|
+ */
|
|
|
60
|
+ dispatch: Dispatch<*>,
|
|
|
61
|
+
|
|
|
62
|
+ /**
|
|
|
63
|
+ * Invoked to obtain translated strings.
|
|
|
64
|
+ */
|
|
|
65
|
+ t: Function
|
|
|
66
|
+};
|
|
|
67
|
+
|
|
|
68
|
+/**
|
|
|
69
|
+ * The type of the React {@code Component} state of {@link InfoDialogButton}.
|
|
|
70
|
+ */
|
|
|
71
|
+type State = {
|
|
|
72
|
+
|
|
|
73
|
+ /**
|
|
|
74
|
+ * Whether or not {@code InfoDialog} should be visible.
|
|
|
75
|
+ */
|
|
|
76
|
+ showDialog: boolean
|
|
|
77
|
+};
|
|
24
|
78
|
|
|
25
|
79
|
/**
|
|
26
|
80
|
* A React Component for displaying a button which opens a dialog with
|
|
|
@@ -28,81 +82,16 @@ const INFO_DIALOG_AUTO_SHOW_TIMEOUT = 1500;
|
|
28
|
82
|
*
|
|
29
|
83
|
* @extends Component
|
|
30
|
84
|
*/
|
|
31
|
|
-class InfoDialogButton extends Component {
|
|
32
|
|
- /**
|
|
33
|
|
- * {@code InfoDialogButton} component's property types.
|
|
34
|
|
- *
|
|
35
|
|
- * @static
|
|
36
|
|
- */
|
|
37
|
|
- static propTypes = {
|
|
38
|
|
-
|
|
39
|
|
- /**
|
|
40
|
|
- * The redux state representing the dial-in numbers feature.
|
|
41
|
|
- */
|
|
42
|
|
- _dialIn: PropTypes.object,
|
|
43
|
|
-
|
|
44
|
|
- /**
|
|
45
|
|
- * Whether or not the {@code InfoDialog} should display automatically
|
|
46
|
|
- * after {@link INFO_DIALOG_AUTO_SHOW_TIMEOUT}.
|
|
47
|
|
- */
|
|
48
|
|
- _disableAutoShow: PropTypes.bool,
|
|
49
|
|
-
|
|
50
|
|
- /**
|
|
51
|
|
- * The URL for a currently active live broadcast
|
|
52
|
|
- */
|
|
53
|
|
- _liveStreamViewURL: PropTypes.string,
|
|
54
|
|
-
|
|
55
|
|
- /**
|
|
56
|
|
- * The number of real participants in the call. If in a lonely call,
|
|
57
|
|
- * the {@code InfoDialog} will be automatically shown.
|
|
58
|
|
- */
|
|
59
|
|
- _participantCount: PropTypes.number,
|
|
60
|
|
-
|
|
61
|
|
- /**
|
|
62
|
|
- * Whether or not the toolbox, in which this component exists, are
|
|
63
|
|
- * visible.
|
|
64
|
|
- */
|
|
65
|
|
- _toolboxVisible: PropTypes.bool,
|
|
66
|
|
-
|
|
67
|
|
- /**
|
|
68
|
|
- * Invoked to toggle display of the info dialog
|
|
69
|
|
- */
|
|
70
|
|
- dispatch: PropTypes.func,
|
|
71
|
|
-
|
|
72
|
|
- /**
|
|
73
|
|
- * Invoked to obtain translated strings.
|
|
74
|
|
- */
|
|
75
|
|
- t: PropTypes.func,
|
|
76
|
|
-
|
|
77
|
|
- /**
|
|
78
|
|
- * From which side tooltips should display. Will be re-used for
|
|
79
|
|
- * displaying the inline dialog for video quality adjustment.
|
|
80
|
|
- */
|
|
81
|
|
- tooltipPosition: PropTypes.string
|
|
82
|
|
- };
|
|
83
|
|
-
|
|
|
85
|
+class InfoDialogButton extends Component<Props, State> {
|
|
84
|
86
|
/**
|
|
85
|
87
|
* Initializes new {@code InfoDialogButton} instance.
|
|
86
|
88
|
*
|
|
87
|
|
- * @param {Object} props - The read-only properties with which the new
|
|
88
|
|
- * instance is to be initialized.
|
|
|
89
|
+ * @inheritdoc
|
|
89
|
90
|
*/
|
|
90
|
91
|
constructor(props) {
|
|
91
|
92
|
super(props);
|
|
92
|
93
|
|
|
93
|
|
- /**
|
|
94
|
|
- * The timeout to automatically show the {@code InfoDialog} if it has
|
|
95
|
|
- * not been shown yet in a lonely call.
|
|
96
|
|
- *
|
|
97
|
|
- * @type {timeoutID}
|
|
98
|
|
- */
|
|
99
|
|
- this._autoShowTimeout = null;
|
|
100
|
|
-
|
|
101
|
|
-
|
|
102
|
94
|
this.state = {
|
|
103
|
|
- /**
|
|
104
|
|
- * Whether or not {@code InfoDialog} should be visible.
|
|
105
|
|
- */
|
|
106
|
95
|
showDialog: false
|
|
107
|
96
|
};
|
|
108
|
97
|
|
|
|
@@ -112,15 +101,11 @@ class InfoDialogButton extends Component {
|
|
112
|
101
|
}
|
|
113
|
102
|
|
|
114
|
103
|
/**
|
|
115
|
|
- * Set a timeout to automatically hide the {@code InfoDialog}.
|
|
|
104
|
+ * Update dial-in numbers {@code InfoDialog}.
|
|
116
|
105
|
*
|
|
117
|
106
|
* @inheritdoc
|
|
118
|
107
|
*/
|
|
119
|
108
|
componentDidMount() {
|
|
120
|
|
- this._autoShowTimeout = setTimeout(() => {
|
|
121
|
|
- this._maybeAutoShowDialog();
|
|
122
|
|
- }, INFO_DIALOG_AUTO_SHOW_TIMEOUT);
|
|
123
|
|
-
|
|
124
|
109
|
if (!this.props._dialIn.numbers) {
|
|
125
|
110
|
this.props.dispatch(updateDialInNumbers());
|
|
126
|
111
|
}
|
|
|
@@ -135,16 +120,11 @@ class InfoDialogButton extends Component {
|
|
135
|
120
|
// Ensure the dialog is closed when the toolbox becomes hidden.
|
|
136
|
121
|
if (this.state.showDialog && !nextProps._toolboxVisible) {
|
|
137
|
122
|
this._onDialogClose();
|
|
|
123
|
+
|
|
|
124
|
+ return;
|
|
138
|
125
|
}
|
|
139
|
|
- }
|
|
140
|
126
|
|
|
141
|
|
- /**
|
|
142
|
|
- * Clear the timeout to automatically show the {@code InfoDialog}.
|
|
143
|
|
- *
|
|
144
|
|
- * @inheritdoc
|
|
145
|
|
- */
|
|
146
|
|
- componentWillUnmount() {
|
|
147
|
|
- clearTimeout(this._autoShowTimeout);
|
|
|
127
|
+ this._maybeAutoShowDialog(nextProps);
|
|
148
|
128
|
}
|
|
149
|
129
|
|
|
150
|
130
|
/**
|
|
|
@@ -180,18 +160,25 @@ class InfoDialogButton extends Component {
|
|
180
|
160
|
}
|
|
181
|
161
|
|
|
182
|
162
|
/**
|
|
183
|
|
- * Callback invoked after a timeout to trigger display of the
|
|
184
|
|
- * {@code InfoDialog} if certain conditions are met.
|
|
|
163
|
+ * Invoked to trigger display of the {@code InfoDialog} if certain
|
|
|
164
|
+ * conditions are met.
|
|
185
|
165
|
*
|
|
|
166
|
+ * @param {Object} nextProps - The future properties of this component.
|
|
186
|
167
|
* @private
|
|
187
|
168
|
* @returns {void}
|
|
188
|
169
|
*/
|
|
189
|
|
- _maybeAutoShowDialog() {
|
|
190
|
|
- if (this.props._participantCount < 2 && !this.props._disableAutoShow) {
|
|
|
170
|
+ _maybeAutoShowDialog(nextProps) {
|
|
|
171
|
+ if (!this.props._isConferenceJoined
|
|
|
172
|
+ && nextProps._isConferenceJoined
|
|
|
173
|
+ && nextProps._participantCount < 2
|
|
|
174
|
+ && nextProps._toolboxVisible
|
|
|
175
|
+ && !nextProps._disableAutoShow) {
|
|
191
|
176
|
this.setState({ showDialog: true });
|
|
192
|
177
|
}
|
|
193
|
178
|
}
|
|
194
|
179
|
|
|
|
180
|
+ _onDialogClose: () => void;
|
|
|
181
|
+
|
|
195
|
182
|
/**
|
|
196
|
183
|
* Hides {@code InfoDialog}.
|
|
197
|
184
|
*
|
|
|
@@ -202,6 +189,8 @@ class InfoDialogButton extends Component {
|
|
202
|
189
|
this.setState({ showDialog: false });
|
|
203
|
190
|
}
|
|
204
|
191
|
|
|
|
192
|
+ _onDialogToggle: () => void;
|
|
|
193
|
+
|
|
205
|
194
|
/**
|
|
206
|
195
|
* Toggles the display of {@code InfoDialog}.
|
|
207
|
196
|
*
|
|
|
@@ -224,6 +213,7 @@ class InfoDialogButton extends Component {
|
|
224
|
213
|
* @returns {{
|
|
225
|
214
|
* _dialIn: Object,
|
|
226
|
215
|
* _disableAutoShow: boolean,
|
|
|
216
|
+ * _isConferenceIsJoined: boolean,
|
|
227
|
217
|
* _liveStreamViewURL: string,
|
|
228
|
218
|
* _participantCount: number,
|
|
229
|
219
|
* _toolboxVisible: boolean
|
|
|
@@ -236,6 +226,8 @@ function _mapStateToProps(state) {
|
|
236
|
226
|
return {
|
|
237
|
227
|
_dialIn: state['features/invite'],
|
|
238
|
228
|
_disableAutoShow: state['features/base/config'].iAmRecorder,
|
|
|
229
|
+ _isConferenceJoined:
|
|
|
230
|
+ Boolean(state['features/base/conference'].conference),
|
|
239
|
231
|
_liveStreamViewURL:
|
|
240
|
232
|
currentLiveStreamingSession
|
|
241
|
233
|
&& currentLiveStreamingSession.liveStreamViewURL,
|