Selaa lähdekoodia

Merge pull request #3636 from virtuacoplenny/lenny/tile-view-toggles-some-features

Tile view toggles some features and some features toggle tile view
master
virtuacoplenny 7 vuotta sitten
vanhempi
commit
05b7e6facc
No account linked to committer's email address

+ 56
- 0
react/features/video-layout/middleware.any.js Näytä tiedosto

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

+ 1
- 0
react/features/video-layout/middleware.native.js Näytä tiedosto

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

+ 1
- 0
react/features/video-layout/middleware.web.js Näytä tiedosto

@@ -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…
Peruuta
Tallenna