浏览代码

Comply w/ coding style

j8
Lyubo Marinov 8 年前
父节点
当前提交
165294bfb1

+ 3
- 7
react/features/background/actionTypes.js 查看文件

10
  *
10
  *
11
  * @protected
11
  * @protected
12
  */
12
  */
13
-export const _SET_APP_STATE_LISTENER
14
-    = Symbol('_SET_APP_STATE_LISTENER');
13
+export const _SET_APP_STATE_LISTENER = Symbol('_SET_APP_STATE_LISTENER');
15
 
14
 
16
 /**
15
 /**
17
  * The type of redux action which signals that video will be muted because the
16
  * The type of redux action which signals that video will be muted because the
28
     = Symbol('_SET_BACKGROUND_VIDEO_MUTED');
27
     = Symbol('_SET_BACKGROUND_VIDEO_MUTED');
29
 
28
 
30
 /**
29
 /**
31
- * The type of redux action which signals that the video channel's lastN value
32
- * must be changed.
30
+ * The type of redux action which sets the video channel's lastN (value).
33
  *
31
  *
34
  * {
32
  * {
35
  *      type: _SET_LASTN,
33
  *      type: _SET_LASTN,
38
  *
36
  *
39
  * @protected
37
  * @protected
40
  */
38
  */
41
-export const _SET_LASTN
42
-    = Symbol('_SET_LASTN');
43
-
39
+export const _SET_LASTN = Symbol('_SET_LASTN');
44
 
40
 
45
 /**
41
 /**
46
  * The type of redux action which signals that the app state has changed (in
42
  * The type of redux action which signals that the app state has changed (in

+ 34
- 26
react/features/background/actions.js 查看文件

7
     APP_STATE_CHANGED
7
     APP_STATE_CHANGED
8
 } from './actionTypes';
8
 } from './actionTypes';
9
 
9
 
10
-/**
11
- * Signals that the App state has changed (in terms of execution state). The
12
- * application can be in 3 states: 'active', 'inactive' and 'background'.
13
- *
14
- * @param {string} appState - The new App state.
15
- * @public
16
- * @returns {{
17
- *      type: APP_STATE_CHANGED,
18
- *      appState: string
19
- * }}
20
- * @see {@link https://facebook.github.io/react-native/docs/appstate.html}
21
- */
22
-export function appStateChanged(appState: string) {
23
-    return {
24
-        type: APP_STATE_CHANGED,
25
-        appState
26
-    };
27
-}
28
-
29
 /**
10
 /**
30
  * Sets the listener to be used with React Native's AppState API.
11
  * Sets the listener to be used with React Native's AppState API.
31
  *
12
  *
61
         const { audioOnly } = getState()['features/base/conference'];
42
         const { audioOnly } = getState()['features/base/conference'];
62
 
43
 
63
         if (!audioOnly) {
44
         if (!audioOnly) {
64
-            const { config } = getState()['features/base/lib-jitsi-meet'];
65
-            const defaultLastN
66
-                = typeof config.channelLastN === 'undefined'
67
-                ? -1 : config.channelLastN;
45
+            let lastN;
46
+
47
+            if (muted) {
48
+                lastN = 0;
49
+            } else {
50
+                const { config } = getState()['features/base/lib-jitsi-meet'];
51
+
52
+                lastN = config.channelLastN;
53
+                if (typeof lastN === 'undefined') {
54
+                    lastN = -1;
55
+                }
56
+            }
68
 
57
 
69
             dispatch({
58
             dispatch({
70
                 type: _SET_LASTN,
59
                 type: _SET_LASTN,
71
-                lastN: muted ? 0 : defaultLastN
60
+                lastN
72
             });
61
             });
73
         }
62
         }
74
 
63
 
75
         if (muted) {
64
         if (muted) {
76
-            const mediaState = getState()['features/base/media'];
65
+            const { video } = getState()['features/base/media'];
77
 
66
 
78
-            if (mediaState.video.muted) {
67
+            if (video.muted) {
79
                 // Video is already muted, do nothing.
68
                 // Video is already muted, do nothing.
80
                 return;
69
                 return;
81
             }
70
             }
97
         dispatch(setVideoMuted(muted));
86
         dispatch(setVideoMuted(muted));
98
     };
87
     };
99
 }
88
 }
89
+
90
+/**
91
+ * Signals that the App state has changed (in terms of execution state). The
92
+ * application can be in 3 states: 'active', 'inactive' and 'background'.
93
+ *
94
+ * @param {string} appState - The new App state.
95
+ * @public
96
+ * @returns {{
97
+ *     type: APP_STATE_CHANGED,
98
+ *     appState: string
99
+ * }}
100
+ * @see {@link https://facebook.github.io/react-native/docs/appstate.html}
101
+ */
102
+export function appStateChanged(appState: string) {
103
+    return {
104
+        type: APP_STATE_CHANGED,
105
+        appState
106
+    };
107
+}

+ 1
- 1
react/features/background/middleware.js 查看文件

54
             try {
54
             try {
55
                 conference.setLastN(action.lastN);
55
                 conference.setLastN(action.lastN);
56
             } catch (err) {
56
             } catch (err) {
57
-                console.warn(`Error setting lastN: ${err}`);
57
+                console.warn(`Failed to set lastN: ${err}`);
58
             }
58
             }
59
         }
59
         }
60
 
60
 

正在加载...
取消
保存