Преглед на файлове

[RN] Simplify the source code

master
Lyubo Marinov преди 8 години
родител
ревизия
f50a31b4e8
променени са 3 файла, в които са добавени 19 реда и са изтрити 18 реда
  1. 6
    7
      react/features/base/connection/actions.native.js
  2. 6
    6
      react/features/base/connection/functions.js
  3. 7
    5
      react/features/base/connection/reducer.js

+ 6
- 7
react/features/base/connection/actions.native.js Целия файл

@@ -22,17 +22,16 @@ const JitsiConnectionEvents = JitsiMeetJS.events.connection;
22 22
 export function connect() {
23 23
     return (dispatch: Dispatch<*>, getState: Function) => {
24 24
         const state = getState();
25
-        const connectionOptions
26
-            = state['features/base/connection'].connectionOptions;
27
-        const room = state['features/base/conference'].room;
25
+        const { options } = state['features/base/connection'];
26
+        const { room } = state['features/base/conference'];
28 27
         const connection
29 28
             = new JitsiMeetJS.JitsiConnection(
30
-                connectionOptions.appId,
31
-                connectionOptions.token,
29
+                options.appId,
30
+                options.token,
32 31
                 {
33
-                    ...connectionOptions,
32
+                    ...options,
34 33
                     bosh:
35
-                        connectionOptions.bosh
34
+                        options.bosh
36 35
 
37 36
                             // XXX The Jitsi Meet deployments require the room
38 37
                             // argument to be in lower case at the time of this

+ 6
- 6
react/features/base/connection/functions.js Целия файл

@@ -12,16 +12,16 @@ export function getDomain(stateOrGetState: Function | Object) {
12 12
         = typeof stateOrGetState === 'function'
13 13
             ? stateOrGetState()
14 14
             : stateOrGetState;
15
-    const connection = state['features/base/connection'];
15
+    const { options } = state['features/base/connection'];
16 16
     let domain;
17 17
 
18 18
     try {
19
-        domain = connection.connectionOptions.hosts.domain;
19
+        domain = options.hosts.domain;
20 20
     } catch (e) {
21
-        // XXX The value of connectionOptions or any of the properties
22
-        // descending from it may be undefined at some point in the execution
23
-        // (e.g. on start). Instead of multiple checks for the undefined value,
24
-        // we just wrap it in a try-catch block.
21
+        // XXX The value of options or any of the properties descending from it
22
+        // may be undefined at some point in the execution (e.g. on start).
23
+        // Instead of multiple checks for the undefined value, we just wrap it
24
+        // in a try-catch block.
25 25
     }
26 26
 
27 27
     return domain;

+ 7
- 5
react/features/base/connection/reducer.js Целия файл

@@ -69,7 +69,7 @@ function _connectionEstablished(state: Object, action: Object) {
69 69
  * @private
70 70
  * @returns {Object}
71 71
  */
72
-function _constructConnectionOptions(domain: string) {
72
+function _constructOptions(domain: string) {
73 73
     // FIXME The HTTPS scheme for the BOSH URL works with meet.jit.si on both
74 74
     // mobile & Web. It also works with beta.meet.jit.si on Web. Unfortunately,
75 75
     // it doesn't work with beta.meet.jit.si on mobile. Temporarily, use the
@@ -96,7 +96,9 @@ function _constructConnectionOptions(domain: string) {
96 96
         bosh: `${String(boshProtocol)}//${domain}/http-bind`,
97 97
         hosts: {
98 98
             domain,
99
-            focus: `focus.${domain}`,
99
+
100
+            // Required by:
101
+            // - lib-jitsi-meet/modules/xmpp/xmpp.js
100 102
             muc: `conference.${domain}`
101 103
         }
102 104
     };
@@ -114,9 +116,9 @@ function _constructConnectionOptions(domain: string) {
114 116
 function _setDomain(state: Object, action: Object) {
115 117
     return {
116 118
         ...state,
117
-        connectionOptions: {
118
-            ...state.connectionOptions,
119
-            ..._constructConnectionOptions(action.domain)
119
+        options: {
120
+            ...state.options,
121
+            ..._constructOptions(action.domain)
120 122
         }
121 123
     };
122 124
 }

Loading…
Отказ
Запис