Procházet zdrojové kódy

Comply w/ coding style

j8
Lyubo Marinov před 8 roky
rodič
revize
165294bfb1

+ 3
- 7
react/features/background/actionTypes.js Zobrazit soubor

@@ -10,8 +10,7 @@ import { Symbol } from '../base/react';
10 10
  *
11 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 16
  * The type of redux action which signals that video will be muted because the
@@ -28,8 +27,7 @@ export const _SET_BACKGROUND_VIDEO_MUTED
28 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 33
  *      type: _SET_LASTN,
@@ -38,9 +36,7 @@ export const _SET_BACKGROUND_VIDEO_MUTED
38 36
  *
39 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 42
  * The type of redux action which signals that the app state has changed (in

+ 34
- 26
react/features/background/actions.js Zobrazit soubor

@@ -7,25 +7,6 @@ import {
7 7
     APP_STATE_CHANGED
8 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 11
  * Sets the listener to be used with React Native's AppState API.
31 12
  *
@@ -61,21 +42,29 @@ export function _setBackgroundVideoMuted(muted: boolean) {
61 42
         const { audioOnly } = getState()['features/base/conference'];
62 43
 
63 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 58
             dispatch({
70 59
                 type: _SET_LASTN,
71
-                lastN: muted ? 0 : defaultLastN
60
+                lastN
72 61
             });
73 62
         }
74 63
 
75 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 68
                 // Video is already muted, do nothing.
80 69
                 return;
81 70
             }
@@ -97,3 +86,22 @@ export function _setBackgroundVideoMuted(muted: boolean) {
97 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 Zobrazit soubor

@@ -54,7 +54,7 @@ MiddlewareRegistry.register(store => next => action => {
54 54
             try {
55 55
                 conference.setLastN(action.lastN);
56 56
             } catch (err) {
57
-                console.warn(`Error setting lastN: ${err}`);
57
+                console.warn(`Failed to set lastN: ${err}`);
58 58
             }
59 59
         }
60 60
 

Načítá se…
Zrušit
Uložit