|
@@ -64,6 +64,17 @@ type Props = {
|
64
|
64
|
*/
|
65
|
65
|
isValidating: boolean,
|
66
|
66
|
|
|
67
|
+ /**
|
|
68
|
+ * The function will be called when there are changes related to the
|
|
69
|
+ * switches.
|
|
70
|
+ */
|
|
71
|
+ onChange: Function,
|
|
72
|
+
|
|
73
|
+ /**
|
|
74
|
+ * The currently selected recording service of type: RECORDING_TYPES.
|
|
75
|
+ */
|
|
76
|
+ selectedRecordingService: ?string,
|
|
77
|
+
|
67
|
78
|
/**
|
68
|
79
|
* Number of MiB of available space in user's Dropbox account.
|
69
|
80
|
*/
|
|
@@ -77,27 +88,15 @@ type Props = {
|
77
|
88
|
/**
|
78
|
89
|
* The display name of the user's Dropbox account.
|
79
|
90
|
*/
|
80
|
|
- userName: ?string,
|
81
|
|
-};
|
82
|
|
-
|
83
|
|
-/**
|
84
|
|
- * State of the component.
|
85
|
|
- */
|
86
|
|
-type State = {
|
87
|
|
-
|
88
|
|
- /**
|
89
|
|
- * The currently selected recording service of type: RECORDING_TYPES.
|
90
|
|
- */
|
91
|
|
- selectedRecordingService: string
|
|
91
|
+ userName: ?string
|
92
|
92
|
};
|
93
|
93
|
|
94
|
|
-
|
95
|
94
|
/**
|
96
|
95
|
* React Component for getting confirmation to start a file recording session.
|
97
|
96
|
*
|
98
|
97
|
* @extends Component
|
99
|
98
|
*/
|
100
|
|
-class StartRecordingDialogContent extends Component<Props, State> {
|
|
99
|
+class StartRecordingDialogContent extends Component<Props> {
|
101
|
100
|
/**
|
102
|
101
|
* Initializes a new {@code StartRecordingDialogContent} instance.
|
103
|
102
|
*
|
|
@@ -113,12 +112,6 @@ class StartRecordingDialogContent extends Component<Props, State> {
|
113
|
112
|
= this._onDropboxSwitchChange.bind(this);
|
114
|
113
|
this._onRecordingServiceSwitchChange
|
115
|
114
|
= this._onRecordingServiceSwitchChange.bind(this);
|
116
|
|
-
|
117
|
|
- // the initial state is jitsi rec service is always selected
|
118
|
|
- // if only one type of recording is enabled this state will be ignored
|
119
|
|
- this.state = {
|
120
|
|
- selectedRecordingService: RECORDING_TYPES.JITSI_REC_SERVICE
|
121
|
|
- };
|
122
|
115
|
}
|
123
|
116
|
|
124
|
117
|
/**
|
|
@@ -165,7 +158,7 @@ class StartRecordingDialogContent extends Component<Props, State> {
|
165
|
158
|
style = { styles.switch }
|
166
|
159
|
trackColor = {{ false: ColorPalette.lightGrey }}
|
167
|
160
|
value = {
|
168
|
|
- this.state.selectedRecordingService
|
|
161
|
+ this.props.selectedRecordingService
|
169
|
162
|
=== RECORDING_TYPES.JITSI_REC_SERVICE } />
|
170
|
163
|
) : null;
|
171
|
164
|
|
|
@@ -243,7 +236,7 @@ class StartRecordingDialogContent extends Component<Props, State> {
|
243
|
236
|
onValueChange = { this._onDropboxSwitchChange }
|
244
|
237
|
style = { styles.switch }
|
245
|
238
|
trackColor = {{ false: ColorPalette.lightGrey }}
|
246
|
|
- value = { this.state.selectedRecordingService
|
|
239
|
+ value = { this.props.selectedRecordingService
|
247
|
240
|
=== RECORDING_TYPES.DROPBOX } />
|
248
|
241
|
);
|
249
|
242
|
}
|
|
@@ -287,18 +280,21 @@ class StartRecordingDialogContent extends Component<Props, State> {
|
287
|
280
|
* @returns {void}
|
288
|
281
|
*/
|
289
|
282
|
_onRecordingServiceSwitchChange() {
|
|
283
|
+ const {
|
|
284
|
+ isTokenValid,
|
|
285
|
+ onChange,
|
|
286
|
+ selectedRecordingService
|
|
287
|
+ } = this.props;
|
290
|
288
|
|
291
|
289
|
// act like group, cannot toggle off
|
292
|
|
- if (this.state.selectedRecordingService
|
|
290
|
+ if (selectedRecordingService
|
293
|
291
|
=== RECORDING_TYPES.JITSI_REC_SERVICE) {
|
294
|
292
|
return;
|
295
|
293
|
}
|
296
|
294
|
|
297
|
|
- this.setState({
|
298
|
|
- selectedRecordingService: RECORDING_TYPES.JITSI_REC_SERVICE
|
299
|
|
- });
|
|
295
|
+ onChange(RECORDING_TYPES.JITSI_REC_SERVICE);
|
300
|
296
|
|
301
|
|
- if (this.props.isTokenValid) {
|
|
297
|
+ if (isTokenValid) {
|
302
|
298
|
this._onSignOut();
|
303
|
299
|
}
|
304
|
300
|
}
|
|
@@ -309,17 +305,21 @@ class StartRecordingDialogContent extends Component<Props, State> {
|
309
|
305
|
* @returns {void}
|
310
|
306
|
*/
|
311
|
307
|
_onDropboxSwitchChange() {
|
|
308
|
+ const {
|
|
309
|
+ isTokenValid,
|
|
310
|
+ onChange,
|
|
311
|
+ selectedRecordingService
|
|
312
|
+ } = this.props;
|
|
313
|
+
|
312
|
314
|
// act like group, cannot toggle off
|
313
|
|
- if (this.state.selectedRecordingService
|
|
315
|
+ if (selectedRecordingService
|
314
|
316
|
=== RECORDING_TYPES.DROPBOX) {
|
315
|
317
|
return;
|
316
|
318
|
}
|
317
|
319
|
|
318
|
|
- this.setState({
|
319
|
|
- selectedRecordingService: RECORDING_TYPES.DROPBOX
|
320
|
|
- });
|
|
320
|
+ onChange(RECORDING_TYPES.DROPBOX);
|
321
|
321
|
|
322
|
|
- if (!this.props.isTokenValid) {
|
|
322
|
+ if (!isTokenValid) {
|
323
|
323
|
this._onSignIn();
|
324
|
324
|
}
|
325
|
325
|
}
|