|
@@ -1,7 +1,5 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
|
-import UIEvents from '../../../../service/UI/UIEvents';
|
4
|
|
-
|
5
|
3
|
import {
|
6
|
4
|
ACTION_PINNED,
|
7
|
5
|
ACTION_UNPINNED,
|
|
@@ -18,6 +16,7 @@ import {
|
18
|
16
|
PIN_PARTICIPANT
|
19
|
17
|
} from '../participants';
|
20
|
18
|
import { MiddlewareRegistry } from '../redux';
|
|
19
|
+import UIEvents from '../../../../service/UI/UIEvents';
|
21
|
20
|
import { TRACK_ADDED, TRACK_REMOVED } from '../tracks';
|
22
|
21
|
|
23
|
22
|
import {
|
|
@@ -97,16 +96,15 @@ MiddlewareRegistry.register(store => next => action => {
|
97
|
96
|
* @param {Action} action - The redux action CONNECTION_ESTABLISHED which is
|
98
|
97
|
* being dispatched in the specified store.
|
99
|
98
|
* @private
|
100
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
101
|
|
- * specified action.
|
|
99
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
102
|
100
|
*/
|
103
|
|
-function _connectionEstablished(store, next, action) {
|
|
101
|
+function _connectionEstablished({ dispatch }, next, action) {
|
104
|
102
|
const result = next(action);
|
105
|
103
|
|
106
|
104
|
// FIXME: workaround for the web version. Currently the creation of the
|
107
|
105
|
// conference is handled by /conference.js
|
108
|
106
|
if (typeof APP === 'undefined') {
|
109
|
|
- store.dispatch(createConference());
|
|
107
|
+ dispatch(createConference());
|
110
|
108
|
}
|
111
|
109
|
|
112
|
110
|
return result;
|
|
@@ -123,8 +121,7 @@ function _connectionEstablished(store, next, action) {
|
123
|
121
|
* @param {Action} action - The redux action {@link CONFERENCE_FAILED} or
|
124
|
122
|
* {@link CONFERENCE_LEFT} which is being dispatched in the specified store.
|
125
|
123
|
* @private
|
126
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
127
|
|
- * specified action.
|
|
124
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
128
|
125
|
*/
|
129
|
126
|
function _conferenceFailedOrLeft({ dispatch, getState }, next, action) {
|
130
|
127
|
const result = next(action);
|
|
@@ -149,20 +146,17 @@ function _conferenceFailedOrLeft({ dispatch, getState }, next, action) {
|
149
|
146
|
* @param {Action} action - The redux action CONFERENCE_JOINED which is being
|
150
|
147
|
* dispatched in the specified store.
|
151
|
148
|
* @private
|
152
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
153
|
|
- * specified action.
|
|
149
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
154
|
150
|
*/
|
155
|
|
-function _conferenceJoined(store, next, action) {
|
|
151
|
+function _conferenceJoined({ dispatch, getState }, next, action) {
|
156
|
152
|
const result = next(action);
|
157
|
|
- const { audioOnly, conference }
|
158
|
|
- = store.getState()['features/base/conference'];
|
|
153
|
+
|
|
154
|
+ const { audioOnly, conference } = getState()['features/base/conference'];
|
159
|
155
|
|
160
|
156
|
// FIXME On Web the audio only mode for "start audio only" is toggled before
|
161
|
157
|
// conference is added to the redux store ("on conference joined" action)
|
162
|
158
|
// and the LastN value needs to be synchronized here.
|
163
|
|
- if (audioOnly && conference.getLastN() !== 0) {
|
164
|
|
- store.dispatch(setLastN(0));
|
165
|
|
- }
|
|
159
|
+ audioOnly && (conference.getLastN() !== 0) && dispatch(setLastN(0));
|
166
|
160
|
|
167
|
161
|
return result;
|
168
|
162
|
}
|
|
@@ -179,11 +173,10 @@ function _conferenceJoined(store, next, action) {
|
179
|
173
|
* @param {Action} action - The redux action PIN_PARTICIPANT which is being
|
180
|
174
|
* dispatched in the specified store.
|
181
|
175
|
* @private
|
182
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
183
|
|
- * specified action.
|
|
176
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
184
|
177
|
*/
|
185
|
|
-function _pinParticipant(store, next, action) {
|
186
|
|
- const state = store.getState();
|
|
178
|
+function _pinParticipant({ getState }, next, action) {
|
|
179
|
+ const state = getState();
|
187
|
180
|
const { conference } = state['features/base/conference'];
|
188
|
181
|
|
189
|
182
|
if (!conference) {
|
|
@@ -248,8 +241,7 @@ function _pinParticipant(store, next, action) {
|
248
|
241
|
* @param {Action} action - The redux action SET_AUDIO_ONLY which is being
|
249
|
242
|
* dispatched in the specified store.
|
250
|
243
|
* @private
|
251
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
252
|
|
- * specified action.
|
|
244
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
253
|
245
|
*/
|
254
|
246
|
function _setAudioOnly({ dispatch, getState }, next, action) {
|
255
|
247
|
const result = next(action);
|
|
@@ -286,11 +278,10 @@ function _setAudioOnly({ dispatch, getState }, next, action) {
|
286
|
278
|
* @param {Action} action - The redux action SET_LASTN which is being dispatched
|
287
|
279
|
* in the specified store.
|
288
|
280
|
* @private
|
289
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
290
|
|
- * specified action.
|
|
281
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
291
|
282
|
*/
|
292
|
|
-function _setLastN(store, next, action) {
|
293
|
|
- const { conference } = store.getState()['features/base/conference'];
|
|
283
|
+function _setLastN({ getState }, next, action) {
|
|
284
|
+ const { conference } = getState()['features/base/conference'];
|
294
|
285
|
|
295
|
286
|
if (conference) {
|
296
|
287
|
try {
|
|
@@ -307,24 +298,21 @@ function _setLastN(store, next, action) {
|
307
|
298
|
* Sets the maximum receive video quality and will turn off audio only mode if
|
308
|
299
|
* enabled.
|
309
|
300
|
*
|
310
|
|
- * @param {Store} store - The Redux store in which the specified action is being
|
|
301
|
+ * @param {Store} store - The redux store in which the specified action is being
|
311
|
302
|
* dispatched.
|
312
|
|
- * @param {Dispatch} next - The Redux dispatch function to dispatch the
|
|
303
|
+ * @param {Dispatch} next - The redux dispatch function to dispatch the
|
313
|
304
|
* specified action to the specified store.
|
314
|
|
- * @param {Action} action - The Redux action SET_RECEIVE_VIDEO_QUALITY which is
|
|
305
|
+ * @param {Action} action - The redux action SET_RECEIVE_VIDEO_QUALITY which is
|
315
|
306
|
* being dispatched in the specified store.
|
316
|
307
|
* @private
|
317
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
318
|
|
- * specified action.
|
|
308
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
319
|
309
|
*/
|
320
|
310
|
function _setReceiveVideoQuality({ dispatch, getState }, next, action) {
|
321
|
311
|
const { audioOnly, conference } = getState()['features/base/conference'];
|
322
|
312
|
|
323
|
313
|
if (conference) {
|
324
|
314
|
conference.setReceiverVideoConstraint(action.receiveVideoQuality);
|
325
|
|
- if (audioOnly) {
|
326
|
|
- dispatch(toggleAudioOnly());
|
327
|
|
- }
|
|
315
|
+ audioOnly && dispatch(toggleAudioOnly());
|
328
|
316
|
}
|
329
|
317
|
|
330
|
318
|
return next(action);
|
|
@@ -362,15 +350,14 @@ function _syncConferenceLocalTracksWithState({ getState }, action) {
|
362
|
350
|
/**
|
363
|
351
|
* Sets the maximum receive video quality.
|
364
|
352
|
*
|
365
|
|
- * @param {Store} store - The Redux store in which the specified action is being
|
|
353
|
+ * @param {Store} store - The redux store in which the specified action is being
|
366
|
354
|
* dispatched.
|
367
|
|
- * @param {Dispatch} next - The Redux dispatch function to dispatch the
|
|
355
|
+ * @param {Dispatch} next - The redux dispatch function to dispatch the
|
368
|
356
|
* specified action to the specified store.
|
369
|
|
- * @param {Action} action - The Redux action DATA_CHANNEL_STATUS_CHANGED which
|
|
357
|
+ * @param {Action} action - The redux action DATA_CHANNEL_STATUS_CHANGED which
|
370
|
358
|
* is being dispatched in the specified store.
|
371
|
359
|
* @private
|
372
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
373
|
|
- * specified action.
|
|
360
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
374
|
361
|
*/
|
375
|
362
|
function _syncReceiveVideoQuality({ getState }, next, action) {
|
376
|
363
|
const state = getState()['features/base/conference'];
|
|
@@ -391,8 +378,7 @@ function _syncReceiveVideoQuality({ getState }, next, action) {
|
391
|
378
|
* @param {Action} action - The redux action TRACK_ADDED or TRACK_REMOVED which
|
392
|
379
|
* is being dispatched in the specified store.
|
393
|
380
|
* @private
|
394
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
395
|
|
- * specified action.
|
|
381
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
396
|
382
|
*/
|
397
|
383
|
function _trackAddedOrRemoved(store, next, action) {
|
398
|
384
|
const track = action.track;
|