|
@@ -1,25 +1,27 @@
|
1
|
|
-// @flow
|
2
|
|
-
|
3
|
|
-import { isNameReadOnly } from '../base/config';
|
4
|
|
-import { SERVER_URL_CHANGE_ENABLED, getFeatureFlag } from '../base/flags';
|
5
|
|
-import { DEFAULT_LANGUAGE, LANGUAGES, i18next } from '../base/i18n';
|
|
1
|
+/* eslint-disable lines-around-comment */
|
|
2
|
+import { IReduxState } from '../app/types';
|
|
3
|
+import { IStateful } from '../base/app/types';
|
|
4
|
+import { isNameReadOnly } from '../base/config/functions';
|
|
5
|
+import { SERVER_URL_CHANGE_ENABLED } from '../base/flags/constants';
|
|
6
|
+import { getFeatureFlag } from '../base/flags/functions';
|
|
7
|
+import i18next, { DEFAULT_LANGUAGE, LANGUAGES } from '../base/i18n/i18next';
|
6
|
8
|
import { createLocalTrack } from '../base/lib-jitsi-meet/functions';
|
7
|
9
|
import {
|
8
|
10
|
getLocalParticipant,
|
9
|
11
|
isLocalParticipantModerator
|
10
|
|
-} from '../base/participants';
|
11
|
|
-import { toState } from '../base/redux';
|
12
|
|
-import { getHideSelfView } from '../base/settings';
|
13
|
|
-import { parseStandardURIString } from '../base/util';
|
|
12
|
+} from '../base/participants/functions';
|
|
13
|
+import { toState } from '../base/redux/functions';
|
|
14
|
+import { getHideSelfView } from '../base/settings/functions';
|
|
15
|
+import { parseStandardURIString } from '../base/util/uri';
|
|
16
|
+// @ts-ignore
|
14
|
17
|
import { isStageFilmstripEnabled } from '../filmstrip/functions';
|
|
18
|
+// @ts-ignore
|
15
|
19
|
import { isFollowMeActive } from '../follow-me';
|
16
|
20
|
import { getParticipantsPaneConfig } from '../participants-pane/functions';
|
17
|
21
|
import { isReactionsEnabled } from '../reactions/functions.any';
|
18
|
22
|
|
19
|
23
|
import { SS_DEFAULT_FRAME_RATE, SS_SUPPORTED_FRAMERATES } from './constants';
|
20
|
24
|
|
21
|
|
-declare var interfaceConfig: Object;
|
22
|
|
-
|
23
|
25
|
/**
|
24
|
26
|
* Used for web. Indicates if the setting section is enabled.
|
25
|
27
|
*
|
|
@@ -39,7 +41,7 @@ export function isSettingEnabled(settingName: string) {
|
39
|
41
|
* {@code getState} function to be used to retrieve the state.
|
40
|
42
|
* @returns {boolean} True to indicate that user can change Server URL, false otherwise.
|
41
|
43
|
*/
|
42
|
|
-export function isServerURLChangeEnabled(stateful: Object | Function) {
|
|
44
|
+export function isServerURLChangeEnabled(stateful: IStateful) {
|
43
|
45
|
const state = toState(stateful);
|
44
|
46
|
const flag = getFeatureFlag(state, SERVER_URL_CHANGE_ENABLED, true);
|
45
|
47
|
|
|
@@ -88,11 +90,15 @@ export function normalizeUserInputURL(url: string) {
|
88
|
90
|
* {@code getState} function to be used to retrieve the state.
|
89
|
91
|
* @returns {Object} - The section of notifications to be configured.
|
90
|
92
|
*/
|
91
|
|
-export function getNotificationsMap(stateful: Object | Function) {
|
|
93
|
+export function getNotificationsMap(stateful: IStateful) {
|
92
|
94
|
const state = toState(stateful);
|
93
|
95
|
const { notifications } = state['features/base/config'];
|
94
|
96
|
const { userSelectedNotifications } = state['features/base/settings'];
|
95
|
97
|
|
|
98
|
+ if (!userSelectedNotifications) {
|
|
99
|
+ return {};
|
|
100
|
+ }
|
|
101
|
+
|
96
|
102
|
return Object.keys(userSelectedNotifications)
|
97
|
103
|
.filter(key => !notifications || notifications.includes(key))
|
98
|
104
|
.reduce((notificationsMap, key) => {
|
|
@@ -111,7 +117,7 @@ export function getNotificationsMap(stateful: Object | Function) {
|
111
|
117
|
* {@code getState} function to be used to retrieve the state.
|
112
|
118
|
* @returns {Object} - The properties for the "More" tab from settings dialog.
|
113
|
119
|
*/
|
114
|
|
-export function getMoreTabProps(stateful: Object | Function) {
|
|
120
|
+export function getMoreTabProps(stateful: IStateful) {
|
115
|
121
|
const state = toState(stateful);
|
116
|
122
|
const framerate = state['features/screen-share'].captureFrameRate ?? SS_DEFAULT_FRAME_RATE;
|
117
|
123
|
const language = i18next.language || DEFAULT_LANGUAGE;
|
|
@@ -147,7 +153,7 @@ export function getMoreTabProps(stateful: Object | Function) {
|
147
|
153
|
* {@code getState} function to be used to retrieve the state.
|
148
|
154
|
* @returns {Object} - The properties for the "More" tab from settings dialog.
|
149
|
155
|
*/
|
150
|
|
-export function getModeratorTabProps(stateful: Object | Function) {
|
|
156
|
+export function getModeratorTabProps(stateful: IStateful) {
|
151
|
157
|
const state = toState(stateful);
|
152
|
158
|
const {
|
153
|
159
|
conference,
|
|
@@ -179,7 +185,7 @@ export function getModeratorTabProps(stateful: Object | Function) {
|
179
|
185
|
* {@code getState} function to be used to retrieve the state.
|
180
|
186
|
* @returns {boolean} True to indicate that moderator tab should be visible, false otherwise.
|
181
|
187
|
*/
|
182
|
|
-export function shouldShowModeratorSettings(stateful: Object | Function) {
|
|
188
|
+export function shouldShowModeratorSettings(stateful: IStateful) {
|
183
|
189
|
const state = toState(stateful);
|
184
|
190
|
const { hideModeratorSettingsTab } = getParticipantsPaneConfig(state);
|
185
|
191
|
const hasModeratorRights = Boolean(isSettingEnabled('moderator') && isLocalParticipantModerator(state));
|
|
@@ -196,7 +202,7 @@ export function shouldShowModeratorSettings(stateful: Object | Function) {
|
196
|
202
|
* @returns {Object} - The properties for the "Profile" tab from settings
|
197
|
203
|
* dialog.
|
198
|
204
|
*/
|
199
|
|
-export function getProfileTabProps(stateful: Object | Function) {
|
|
205
|
+export function getProfileTabProps(stateful: IStateful) {
|
200
|
206
|
const state = toState(stateful);
|
201
|
207
|
const {
|
202
|
208
|
authEnabled,
|
|
@@ -209,8 +215,8 @@ export function getProfileTabProps(stateful: Object | Function) {
|
209
|
215
|
return {
|
210
|
216
|
authEnabled: Boolean(conference && authEnabled),
|
211
|
217
|
authLogin,
|
212
|
|
- displayName: localParticipant.name,
|
213
|
|
- email: localParticipant.email,
|
|
218
|
+ displayName: localParticipant?.name,
|
|
219
|
+ email: localParticipant?.email,
|
214
|
220
|
readOnlyName: isNameReadOnly(state),
|
215
|
221
|
hideEmailInSettings
|
216
|
222
|
};
|
|
@@ -225,7 +231,7 @@ export function getProfileTabProps(stateful: Object | Function) {
|
225
|
231
|
* @returns {Object} - The properties for the "Sounds" tab from settings
|
226
|
232
|
* dialog.
|
227
|
233
|
*/
|
228
|
|
-export function getSoundsTabProps(stateful: Object | Function) {
|
|
234
|
+export function getSoundsTabProps(stateful: IStateful) {
|
229
|
235
|
const state = toState(stateful);
|
230
|
236
|
const {
|
231
|
237
|
soundsIncomingMessage,
|
|
@@ -259,21 +265,21 @@ export function getSoundsTabProps(stateful: Object | Function) {
|
259
|
265
|
*
|
260
|
266
|
* @returns {Promise<Object[]>}
|
261
|
267
|
*/
|
262
|
|
-export function createLocalVideoTracks(ids: string[], timeout: ?number) {
|
|
268
|
+export function createLocalVideoTracks(ids: string[], timeout?: number) {
|
263
|
269
|
return Promise.all(ids.map(deviceId => createLocalTrack('video', deviceId, timeout)
|
264
|
|
- .then(jitsiTrack => {
|
265
|
|
- return {
|
266
|
|
- jitsiTrack,
|
267
|
|
- deviceId
|
268
|
|
- };
|
269
|
|
- })
|
270
|
|
- .catch(() => {
|
271
|
|
- return {
|
272
|
|
- jitsiTrack: null,
|
273
|
|
- deviceId,
|
274
|
|
- error: 'deviceSelection.previewUnavailable'
|
275
|
|
- };
|
276
|
|
- })));
|
|
270
|
+ .then((jitsiTrack: any) => {
|
|
271
|
+ return {
|
|
272
|
+ jitsiTrack,
|
|
273
|
+ deviceId
|
|
274
|
+ };
|
|
275
|
+ })
|
|
276
|
+ .catch(() => {
|
|
277
|
+ return {
|
|
278
|
+ jitsiTrack: null,
|
|
279
|
+ deviceId,
|
|
280
|
+ error: 'deviceSelection.previewUnavailable'
|
|
281
|
+ };
|
|
282
|
+ })));
|
277
|
283
|
}
|
278
|
284
|
|
279
|
285
|
|
|
@@ -290,7 +296,7 @@ export function createLocalVideoTracks(ids: string[], timeout: ?number) {
|
290
|
296
|
* label: string
|
291
|
297
|
* }[]>}
|
292
|
298
|
*/
|
293
|
|
-export function createLocalAudioTracks(devices: Object[], timeout: ?number) {
|
|
299
|
+export function createLocalAudioTracks(devices: MediaDeviceInfo[], timeout?: number) {
|
294
|
300
|
return Promise.all(
|
295
|
301
|
devices.map(async ({ deviceId, label }) => {
|
296
|
302
|
let jitsiTrack = null;
|
|
@@ -317,7 +323,7 @@ export function createLocalAudioTracks(devices: Object[], timeout: ?number) {
|
317
|
323
|
* @param {Object} state - The state of the application.
|
318
|
324
|
* @returns {boolean}
|
319
|
325
|
*/
|
320
|
|
-export function getAudioSettingsVisibility(state: Object) {
|
|
326
|
+export function getAudioSettingsVisibility(state: IReduxState) {
|
321
|
327
|
return state['features/settings'].audioSettingsVisible;
|
322
|
328
|
}
|
323
|
329
|
|
|
@@ -327,6 +333,6 @@ export function getAudioSettingsVisibility(state: Object) {
|
327
|
333
|
* @param {Object} state - The state of the application.
|
328
|
334
|
* @returns {boolean}
|
329
|
335
|
*/
|
330
|
|
-export function getVideoSettingsVisibility(state: Object) {
|
|
336
|
+export function getVideoSettingsVisibility(state: IReduxState) {
|
331
|
337
|
return state['features/settings'].videoSettingsVisible;
|
332
|
338
|
}
|