|
|
@@ -34,10 +34,45 @@ type Props = AbstractProps & {
|
|
34
|
34
|
|
|
35
|
35
|
type State = {
|
|
36
|
36
|
|
|
|
37
|
+ /**
|
|
|
38
|
+ * State variable for the disable call integration switch.
|
|
|
39
|
+ */
|
|
|
40
|
+ disableCallIntegration: boolean,
|
|
|
41
|
+
|
|
|
42
|
+ /**
|
|
|
43
|
+ * State variable for the disable p2p switch.
|
|
|
44
|
+ */
|
|
|
45
|
+ disableP2P: boolean,
|
|
|
46
|
+
|
|
|
47
|
+ /**
|
|
|
48
|
+ * State variable for the display name field.
|
|
|
49
|
+ */
|
|
|
50
|
+ displayName: string,
|
|
|
51
|
+
|
|
|
52
|
+ /**
|
|
|
53
|
+ * State variable for the email field.
|
|
|
54
|
+ */
|
|
|
55
|
+ email: string,
|
|
|
56
|
+
|
|
|
57
|
+ /**
|
|
|
58
|
+ * State variable for the server URL field.
|
|
|
59
|
+ */
|
|
|
60
|
+ serverURL: string,
|
|
|
61
|
+
|
|
37
|
62
|
/**
|
|
38
|
63
|
* Whether to show advanced settings or not.
|
|
39
|
64
|
*/
|
|
40
|
|
- showAdvanced: boolean
|
|
|
65
|
+ showAdvanced: boolean,
|
|
|
66
|
+
|
|
|
67
|
+ /**
|
|
|
68
|
+ * State variable for the start with audio muted switch.
|
|
|
69
|
+ */
|
|
|
70
|
+ startWithAudioMuted: boolean,
|
|
|
71
|
+
|
|
|
72
|
+ /**
|
|
|
73
|
+ * State variable for the start with video muted switch.
|
|
|
74
|
+ */
|
|
|
75
|
+ startWithVideoMuted: boolean,
|
|
41
|
76
|
}
|
|
42
|
77
|
|
|
43
|
78
|
/**
|
|
|
@@ -55,9 +90,25 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
55
|
90
|
*/
|
|
56
|
91
|
constructor(props) {
|
|
57
|
92
|
super(props);
|
|
|
93
|
+ const {
|
|
|
94
|
+ disableCallIntegration,
|
|
|
95
|
+ disableP2P,
|
|
|
96
|
+ displayName,
|
|
|
97
|
+ email,
|
|
|
98
|
+ serverURL,
|
|
|
99
|
+ startWithAudioMuted,
|
|
|
100
|
+ startWithVideoMuted
|
|
|
101
|
+ } = props._settings || {};
|
|
58
|
102
|
|
|
59
|
103
|
this.state = {
|
|
60
|
|
- showAdvanced: false
|
|
|
104
|
+ disableCallIntegration,
|
|
|
105
|
+ disableP2P,
|
|
|
106
|
+ displayName,
|
|
|
107
|
+ email,
|
|
|
108
|
+ serverURL,
|
|
|
109
|
+ showAdvanced: false,
|
|
|
110
|
+ startWithAudioMuted,
|
|
|
111
|
+ startWithVideoMuted
|
|
61
|
112
|
};
|
|
62
|
113
|
|
|
63
|
114
|
// Bind event handlers so they are only bound once per instance.
|
|
|
@@ -103,25 +154,61 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
103
|
154
|
this._processServerURL(false /* hideOnSuccess */);
|
|
104
|
155
|
}
|
|
105
|
156
|
|
|
106
|
|
- _onChangeDisplayName: (string) => void;
|
|
|
157
|
+ /**
|
|
|
158
|
+ * Callback to update the display name.
|
|
|
159
|
+ *
|
|
|
160
|
+ * @param {string} displayName - The new value to set.
|
|
|
161
|
+ * @returns {void}
|
|
|
162
|
+ */
|
|
|
163
|
+ _onChangeDisplayName(displayName) {
|
|
|
164
|
+ super._onChangeDisplayName(displayName);
|
|
|
165
|
+ this.setState({
|
|
|
166
|
+ displayName
|
|
|
167
|
+ });
|
|
|
168
|
+ }
|
|
107
|
169
|
|
|
108
|
|
- _onChangeEmail: (string) => void;
|
|
|
170
|
+ /**
|
|
|
171
|
+ * Callback to update the email.
|
|
|
172
|
+ *
|
|
|
173
|
+ * @param {string} email - The new value to set.
|
|
|
174
|
+ * @returns {void}
|
|
|
175
|
+ */
|
|
|
176
|
+ _onChangeEmail(email) {
|
|
|
177
|
+ super._onChangeEmail(email);
|
|
|
178
|
+ this.setState({
|
|
|
179
|
+ email
|
|
|
180
|
+ });
|
|
|
181
|
+ }
|
|
109
|
182
|
|
|
110
|
|
- _onChangeServerURL: (string) => void;
|
|
|
183
|
+ /**
|
|
|
184
|
+ * Callback to update the server URL.
|
|
|
185
|
+ *
|
|
|
186
|
+ * @param {string} serverURL - The new value to set.
|
|
|
187
|
+ * @returns {void}
|
|
|
188
|
+ */
|
|
|
189
|
+ _onChangeServerURL(serverURL) {
|
|
|
190
|
+ super._onChangeServerURL(serverURL);
|
|
|
191
|
+ this.setState({
|
|
|
192
|
+ serverURL
|
|
|
193
|
+ });
|
|
|
194
|
+ }
|
|
111
|
195
|
|
|
112
|
196
|
_onDisableCallIntegration: (boolean) => void;
|
|
113
|
197
|
|
|
114
|
198
|
/**
|
|
115
|
199
|
* Handles the disable call integration change event.
|
|
116
|
200
|
*
|
|
117
|
|
- * @param {boolean} newValue - The new value
|
|
|
201
|
+ * @param {boolean} disableCallIntegration - The new value
|
|
118
|
202
|
* option.
|
|
119
|
203
|
* @private
|
|
120
|
204
|
* @returns {void}
|
|
121
|
205
|
*/
|
|
122
|
|
- _onDisableCallIntegration(newValue) {
|
|
|
206
|
+ _onDisableCallIntegration(disableCallIntegration) {
|
|
123
|
207
|
this._updateSettings({
|
|
124
|
|
- disableCallIntegration: newValue
|
|
|
208
|
+ disableCallIntegration
|
|
|
209
|
+ });
|
|
|
210
|
+ this.setState({
|
|
|
211
|
+ disableCallIntegration
|
|
125
|
212
|
});
|
|
126
|
213
|
}
|
|
127
|
214
|
|
|
|
@@ -130,14 +217,17 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
130
|
217
|
/**
|
|
131
|
218
|
* Handles the disable P2P change event.
|
|
132
|
219
|
*
|
|
133
|
|
- * @param {boolean} newValue - The new value
|
|
|
220
|
+ * @param {boolean} disableP2P - The new value
|
|
134
|
221
|
* option.
|
|
135
|
222
|
* @private
|
|
136
|
223
|
* @returns {void}
|
|
137
|
224
|
*/
|
|
138
|
|
- _onDisableP2P(newValue) {
|
|
|
225
|
+ _onDisableP2P(disableP2P) {
|
|
139
|
226
|
this._updateSettings({
|
|
140
|
|
- disableP2P: newValue
|
|
|
227
|
+ disableP2P
|
|
|
228
|
+ });
|
|
|
229
|
+ this.setState({
|
|
|
230
|
+ disableP2P
|
|
141
|
231
|
});
|
|
142
|
232
|
}
|
|
143
|
233
|
|
|
|
@@ -165,9 +255,31 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
165
|
255
|
this.setState({ showAdvanced: !this.state.showAdvanced });
|
|
166
|
256
|
}
|
|
167
|
257
|
|
|
168
|
|
- _onStartAudioMutedChange: (boolean) => void;
|
|
|
258
|
+ /**
|
|
|
259
|
+ * Callback to update the start with audio muted value.
|
|
|
260
|
+ *
|
|
|
261
|
+ * @param {boolean} startWithAudioMuted - The new value to set.
|
|
|
262
|
+ * @returns {void}
|
|
|
263
|
+ */
|
|
|
264
|
+ _onStartAudioMutedChange(startWithAudioMuted) {
|
|
|
265
|
+ super._onStartAudioMutedChange(startWithAudioMuted);
|
|
|
266
|
+ this.setState({
|
|
|
267
|
+ startWithAudioMuted
|
|
|
268
|
+ });
|
|
|
269
|
+ }
|
|
169
|
270
|
|
|
170
|
|
- _onStartVideoMutedChange: (boolean) => void;
|
|
|
271
|
+ /**
|
|
|
272
|
+ * Callback to update the start with video muted value.
|
|
|
273
|
+ *
|
|
|
274
|
+ * @param {boolean} startWithVideoMuted - The new value to set.
|
|
|
275
|
+ * @returns {void}
|
|
|
276
|
+ */
|
|
|
277
|
+ _onStartVideoMutedChange(startWithVideoMuted) {
|
|
|
278
|
+ super._onStartVideoMutedChange(startWithVideoMuted);
|
|
|
279
|
+ this.setState({
|
|
|
280
|
+ startWithVideoMuted
|
|
|
281
|
+ });
|
|
|
282
|
+ }
|
|
171
|
283
|
|
|
172
|
284
|
/**
|
|
173
|
285
|
* Processes the server URL. It normalizes it and an error alert is
|
|
|
@@ -199,8 +311,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
199
|
311
|
* @returns {React$Element}
|
|
200
|
312
|
*/
|
|
201
|
313
|
_renderAdvancedSettings() {
|
|
202
|
|
- const { _settings } = this.props;
|
|
203
|
|
- const { showAdvanced } = this.state;
|
|
|
314
|
+ const { disableCallIntegration, disableP2P, showAdvanced } = this.state;
|
|
204
|
315
|
|
|
205
|
316
|
if (!showAdvanced) {
|
|
206
|
317
|
return (
|
|
|
@@ -221,14 +332,14 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
221
|
332
|
label = 'settingsView.disableCallIntegration'>
|
|
222
|
333
|
<Switch
|
|
223
|
334
|
onValueChange = { this._onDisableCallIntegration }
|
|
224
|
|
- value = { _settings.disableCallIntegration } />
|
|
|
335
|
+ value = { disableCallIntegration } />
|
|
225
|
336
|
</FormRow>
|
|
226
|
337
|
<FormRow
|
|
227
|
338
|
fieldSeparator = { true }
|
|
228
|
339
|
label = 'settingsView.disableP2P'>
|
|
229
|
340
|
<Switch
|
|
230
|
341
|
onValueChange = { this._onDisableP2P }
|
|
231
|
|
- value = { _settings.disableP2P } />
|
|
|
342
|
+ value = { disableP2P } />
|
|
232
|
343
|
</FormRow>
|
|
233
|
344
|
</>
|
|
234
|
345
|
);
|
|
|
@@ -241,7 +352,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
241
|
352
|
* @returns {React$Element}
|
|
242
|
353
|
*/
|
|
243
|
354
|
_renderBody() {
|
|
244
|
|
- const { _settings } = this.props;
|
|
|
355
|
+ const { displayName, email, serverURL, startWithAudioMuted, startWithVideoMuted } = this.state;
|
|
245
|
356
|
|
|
246
|
357
|
return (
|
|
247
|
358
|
<SafeAreaView style = { styles.settingsForm }>
|
|
|
@@ -255,7 +366,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
255
|
366
|
autoCorrect = { false }
|
|
256
|
367
|
onChangeText = { this._onChangeDisplayName }
|
|
257
|
368
|
placeholder = 'John Doe'
|
|
258
|
|
- value = { _settings.displayName } />
|
|
|
369
|
+ value = { displayName } />
|
|
259
|
370
|
</FormRow>
|
|
260
|
371
|
<FormRow label = 'settingsView.email'>
|
|
261
|
372
|
<TextInput
|
|
|
@@ -264,7 +375,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
264
|
375
|
keyboardType = { 'email-address' }
|
|
265
|
376
|
onChangeText = { this._onChangeEmail }
|
|
266
|
377
|
placeholder = 'email@example.com'
|
|
267
|
|
- value = { _settings.email } />
|
|
|
378
|
+ value = { email } />
|
|
268
|
379
|
</FormRow>
|
|
269
|
380
|
<FormSectionHeader
|
|
270
|
381
|
label = 'settingsView.conferenceSection' />
|
|
|
@@ -277,19 +388,19 @@ class SettingsView extends AbstractSettingsView<Props, State> {
|
|
277
|
388
|
onBlur = { this._onBlurServerURL }
|
|
278
|
389
|
onChangeText = { this._onChangeServerURL }
|
|
279
|
390
|
placeholder = { this.props._serverURL }
|
|
280
|
|
- value = { _settings.serverURL } />
|
|
|
391
|
+ value = { serverURL } />
|
|
281
|
392
|
</FormRow>
|
|
282
|
393
|
<FormRow
|
|
283
|
394
|
fieldSeparator = { true }
|
|
284
|
395
|
label = 'settingsView.startWithAudioMuted'>
|
|
285
|
396
|
<Switch
|
|
286
|
397
|
onValueChange = { this._onStartAudioMutedChange }
|
|
287
|
|
- value = { _settings.startWithAudioMuted } />
|
|
|
398
|
+ value = { startWithAudioMuted } />
|
|
288
|
399
|
</FormRow>
|
|
289
|
400
|
<FormRow label = 'settingsView.startWithVideoMuted'>
|
|
290
|
401
|
<Switch
|
|
291
|
402
|
onValueChange = { this._onStartVideoMutedChange }
|
|
292
|
|
- value = { _settings.startWithVideoMuted } />
|
|
|
403
|
+ value = { startWithVideoMuted } />
|
|
293
|
404
|
</FormRow>
|
|
294
|
405
|
<FormSectionHeader
|
|
295
|
406
|
label = 'settingsView.buildInfoSection' />
|