Browse Source

fix(tile-view): disable tile view on pin, unpin all on view enter

master
Leonard Kim 6 years ago
parent
commit
29bc18df01

+ 39
- 0
react/features/video-layout/middleware.any.js View File

@@ -0,0 +1,39 @@
1
+import {
2
+    PIN_PARTICIPANT,
3
+    getPinnedParticipant,
4
+    pinParticipant
5
+} from '../base/participants';
6
+import { MiddlewareRegistry } from '../base/redux';
7
+
8
+import { SET_TILE_VIEW } from './actionTypes';
9
+import { setTileView } from './actions';
10
+
11
+/**
12
+ * Middleware which intercepts actions and updates tile view related state.
13
+ *
14
+ * @param {Store} store - The redux store.
15
+ * @returns {Function}
16
+ */
17
+MiddlewareRegistry.register(store => next => action => {
18
+    switch (action.type) {
19
+    case PIN_PARTICIPANT: {
20
+        const isPinning = Boolean(action.participant.id);
21
+        const { tileViewEnabled } = store.getState()['features/video-layout'];
22
+
23
+        if (isPinning && tileViewEnabled) {
24
+            store.dispatch(setTileView(false));
25
+        }
26
+
27
+        break;
28
+    }
29
+
30
+    case SET_TILE_VIEW:
31
+        if (getPinnedParticipant(store.getState()) && action.enabled) {
32
+            store.dispatch(pinParticipant(null));
33
+        }
34
+
35
+        break;
36
+    }
37
+
38
+    return next(action);
39
+});

+ 1
- 0
react/features/video-layout/middleware.native.js View File

@@ -0,0 +1 @@
1
+import './middleware.any';

+ 1
- 0
react/features/video-layout/middleware.web.js View File

@@ -17,6 +17,7 @@ import { TRACK_ADDED } from '../base/tracks';
17 17
 import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
18 18
 
19 19
 import { SET_TILE_VIEW } from './actionTypes';
20
+import './middleware.any';
20 21
 
21 22
 declare var APP: Object;
22 23
 

Loading…
Cancel
Save