Procházet zdrojové kódy

Comply w/ coding style

- Use 1 name for 1 abstraction. Instead of useFullScreen and enabled use
  fullScreen.
- Comments are correct English sentences so no double spaces between
  senteces, no capitalization of the work On midsentence.
- Write as little source code as possible if readability is preserved.
- Utilize Facebook's Flow.
- The name of a private function must start with _ and the jsdoc should
  state that the function is private.
j8
Lyubomir Marinov před 8 roky
rodič
revize
2ad869a036

+ 2
- 2
android/settings.gradle Zobrazit soubor

@@ -1,8 +1,8 @@
1 1
 rootProject.name = 'jitsi-meet-react'
2
-include ':react-native-immersive'
3
-project(':react-native-immersive').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-immersive/android')
4 2
 
5 3
 include ':app'
4
+include ':react-native-immersive'
5
+project(':react-native-immersive').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-immersive/android')
6 6
 include ':react-native-keep-awake'
7 7
 project(':react-native-keep-awake').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keep-awake/android')
8 8
 include ':react-native-vector-icons'

+ 1
- 1
package.json Zobrazit soubor

@@ -22,11 +22,11 @@
22 22
     "bootstrap": "3.1.1",
23 23
     "i18next": "3.4.4",
24 24
     "i18next-xhr-backend": "1.1.0",
25
-    "jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0",
26 25
     "jitsi-meet-logger": "jitsi/jitsi-meet-logger",
27 26
     "jquery": "~2.1.1",
28 27
     "jquery-contextmenu": "*",
29 28
     "jquery-i18next": "1.1.0",
29
+    "jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0",
30 30
     "jquery-ui": "1.10.5",
31 31
     "jssha": "1.5.0",
32 32
     "jws": "*",

+ 5
- 1
react/features/audio-mode/middleware.js Zobrazit soubor

@@ -1,3 +1,5 @@
1
+/* @flow */
2
+
1 3
 import { NativeModules } from 'react-native';
2 4
 
3 5
 import { APP_WILL_MOUNT } from '../app';
@@ -49,7 +51,9 @@ MiddlewareRegistry.register(store => next => action => {
49 51
         if (mode !== null) {
50 52
             AudioMode.setMode(mode)
51 53
                 .catch(err =>
52
-                    console.error(`Failed to set audio mode ${mode}: ${err}`));
54
+                    console.error(
55
+                            `Failed to set audio mode ${String(mode)}: `
56
+                                + `${err}`));
53 57
         }
54 58
     }
55 59
 

+ 22
- 22
react/features/full-screen/middleware.js Zobrazit soubor

@@ -1,3 +1,5 @@
1
+/* @flow */
2
+
1 3
 import { StatusBar } from 'react-native';
2 4
 import { Immersive } from 'react-native-immersive';
3 5
 
@@ -11,7 +13,7 @@ import { MiddlewareRegistry } from '../base/redux';
11 13
 
12 14
 /**
13 15
  * Middleware that captures conference actions and activates or deactivates the
14
- * full screen mode.  On iOS it hides the status bar, and on Android it uses the
16
+ * full screen mode. On iOS it hides the status bar, and on Android it uses the
15 17
  * immersive mode:
16 18
  * https://developer.android.com/training/system-ui/immersive.html
17 19
  * In immersive mode the status and navigation bars are hidden and thus the
@@ -21,31 +23,30 @@ import { MiddlewareRegistry } from '../base/redux';
21 23
  * @returns {Function}
22 24
  */
23 25
 MiddlewareRegistry.register(store => next => action => {
24
-    let useFullScreen;
26
+    let fullScreen;
25 27
 
26 28
     switch (action.type) {
27 29
     case CONFERENCE_WILL_JOIN: {
28
-        const state = store.getState()['features/base/conference'];
30
+        const conference = store.getState()['features/base/conference'];
29 31
 
30
-        useFullScreen = !state.audioOnly;
32
+        fullScreen = !conference.audioOnly;
31 33
         break;
32 34
     }
33 35
 
34 36
     case CONFERENCE_FAILED:
35 37
     case CONFERENCE_LEFT:
36
-        useFullScreen = false;
38
+        fullScreen = false;
37 39
         break;
38 40
 
39 41
     default:
40
-        useFullScreen = null;
42
+        fullScreen = null;
41 43
         break;
42 44
     }
43 45
 
44
-    if (useFullScreen !== null) {
45
-        setFullScreen(useFullScreen)
46
-            .catch(err => {
47
-                console.warn(`Error setting full screen mode: ${err}`);
48
-            });
46
+    if (fullScreen !== null) {
47
+        _setFullScreen(fullScreen)
48
+            .catch(err =>
49
+                console.warn(`Failed to set full screen mode: ${err}`));
49 50
     }
50 51
 
51 52
     return next(action);
@@ -53,24 +54,23 @@ MiddlewareRegistry.register(store => next => action => {
53 54
 
54 55
 /**
55 56
  * Activates/deactivates the full screen mode. On iOS it will hide the status
56
- * bar and On Android this will turn on immersive mode.
57
+ * bar, and on Android it will turn immersive mode on.
57 58
  *
58
- * @param {boolean} enabled - True to set full screen mode, false to
59
+ * @param {boolean} fullScreen - True to set full screen mode, false to
59 60
  * deactivate it.
61
+ * @private
60 62
  * @returns {Promise}
61 63
  */
62
-function setFullScreen(enabled) {
63
-    // XXX The Immersive module is only implemented on Android and throws on
64
-    // other platforms.
64
+function _setFullScreen(fullScreen: boolean) {
65
+    // XXX The React Native module Immersive is only implemented on Android and
66
+    // throws on other platforms.
65 67
     if (Platform.OS === 'android') {
66
-        if (enabled) {
67
-            return Immersive.on();
68
-        }
69
-
70
-        return Immersive.off();
68
+        return fullScreen ? Immersive.on() : Immersive.off();
71 69
     }
72 70
 
73
-    StatusBar.setHidden(enabled, 'slide');
71
+    // On platforms other than Android go with whatever React Native itself
72
+    // supports.
73
+    StatusBar.setHidden(fullScreen, 'slide');
74 74
 
75 75
     return Promise.resolve();
76 76
 }

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