Browse Source

[RN] Simplify the source code

master
Lyubo Marinov 8 years ago
parent
commit
f50a31b4e8

+ 6
- 7
react/features/base/connection/actions.native.js View File

22
 export function connect() {
22
 export function connect() {
23
     return (dispatch: Dispatch<*>, getState: Function) => {
23
     return (dispatch: Dispatch<*>, getState: Function) => {
24
         const state = getState();
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
         const connection
27
         const connection
29
             = new JitsiMeetJS.JitsiConnection(
28
             = new JitsiMeetJS.JitsiConnection(
30
-                connectionOptions.appId,
31
-                connectionOptions.token,
29
+                options.appId,
30
+                options.token,
32
                 {
31
                 {
33
-                    ...connectionOptions,
32
+                    ...options,
34
                     bosh:
33
                     bosh:
35
-                        connectionOptions.bosh
34
+                        options.bosh
36
 
35
 
37
                             // XXX The Jitsi Meet deployments require the room
36
                             // XXX The Jitsi Meet deployments require the room
38
                             // argument to be in lower case at the time of this
37
                             // argument to be in lower case at the time of this

+ 6
- 6
react/features/base/connection/functions.js View File

12
         = typeof stateOrGetState === 'function'
12
         = typeof stateOrGetState === 'function'
13
             ? stateOrGetState()
13
             ? stateOrGetState()
14
             : stateOrGetState;
14
             : stateOrGetState;
15
-    const connection = state['features/base/connection'];
15
+    const { options } = state['features/base/connection'];
16
     let domain;
16
     let domain;
17
 
17
 
18
     try {
18
     try {
19
-        domain = connection.connectionOptions.hosts.domain;
19
+        domain = options.hosts.domain;
20
     } catch (e) {
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
     return domain;
27
     return domain;

+ 7
- 5
react/features/base/connection/reducer.js View File

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