Browse Source

[RN] Unpin participant and set last N to 1 if the filmstrip is disabled

master
Saúl Ibarra Corretgé 7 years ago
parent
commit
417e1e83e7
1 changed files with 21 additions and 4 deletions
  1. 21
    4
      react/features/filmstrip/middleware.js

+ 21
- 4
react/features/filmstrip/middleware.js View File

@@ -1,14 +1,17 @@
1
-/* @flow */
1
+// @flow
2 2
 
3
-import { MiddlewareRegistry } from '../base/redux';
3
+import { setLastN } from '../base/conference';
4 4
 import { SET_CALLEE_INFO_VISIBLE } from '../base/jwt';
5
+import { pinParticipant } from '../base/participants';
6
+import { MiddlewareRegistry } from '../base/redux';
5 7
 
6 8
 import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
7 9
 
10
+import { SET_FILMSTRIP_ENABLED } from './actionTypes';
11
+
8 12
 declare var APP: Object;
9 13
 
10
-// eslint-disable-next-line no-unused-vars
11
-MiddlewareRegistry.register(({ getState }) => next => action => {
14
+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
12 15
     switch (action.type) {
13 16
     case SET_CALLEE_INFO_VISIBLE:
14 17
         if (typeof APP !== 'undefined') {
@@ -31,6 +34,20 @@ MiddlewareRegistry.register(({ getState }) => next => action => {
31 34
             return result;
32 35
         }
33 36
         break;
37
+
38
+    case SET_FILMSTRIP_ENABLED:
39
+        // FIXME: Only do this on mobile for now. The logic for participant
40
+        // pinning / unpinning is not on React yet so dispatching the action
41
+        // is not enough.
42
+        if (typeof APP === 'undefined') {
43
+            const { audioOnly } = getState()['features/base/conference'];
44
+            const { enabled } = action;
45
+
46
+            !enabled && dispatch(pinParticipant(null));
47
+            !audioOnly && dispatch(setLastN(enabled ? undefined : 1));
48
+        }
49
+        break;
50
+
34 51
     }
35 52
 
36 53
     return next(action);

Loading…
Cancel
Save