Browse Source

feat: pass network info to LJM

master
paweldomas 5 years ago
parent
commit
bc43f00d28

+ 7
- 1
react/features/base/lib-jitsi-meet/actions.js View File

2
 
2
 
3
 import type { Dispatch } from 'redux';
3
 import type { Dispatch } from 'redux';
4
 
4
 
5
+import { isOnline } from '../net-info/selectors';
6
+
5
 import JitsiMeetJS from './_';
7
 import JitsiMeetJS from './_';
6
 import {
8
 import {
7
     LIB_DID_DISPOSE,
9
     LIB_DID_DISPOSE,
37
  */
39
  */
38
 export function initLib() {
40
 export function initLib() {
39
     return (dispatch: Dispatch<any>, getState: Function): void => {
41
     return (dispatch: Dispatch<any>, getState: Function): void => {
40
-        const config = getState()['features/base/config'];
42
+        const state = getState();
43
+        const config = state['features/base/config'];
41
 
44
 
42
         if (!config) {
45
         if (!config) {
43
             throw new Error('Cannot init lib-jitsi-meet without config');
46
             throw new Error('Cannot init lib-jitsi-meet without config');
50
                 enableAnalyticsLogging: isAnalyticsEnabled(getState),
53
                 enableAnalyticsLogging: isAnalyticsEnabled(getState),
51
                 ...config
54
                 ...config
52
             });
55
             });
56
+            JitsiMeetJS.setNetworkInfo({
57
+                isOnline: isOnline(state)
58
+            });
53
             dispatch({ type: LIB_DID_INIT });
59
             dispatch({ type: LIB_DID_INIT });
54
         } catch (error) {
60
         } catch (error) {
55
             dispatch(libInitError(error));
61
             dispatch(libInitError(error));

+ 7
- 0
react/features/base/lib-jitsi-meet/middleware.js View File

2
 
2
 
3
 import { SET_CONFIG } from '../config';
3
 import { SET_CONFIG } from '../config';
4
 import { setLoggingConfig } from '../logging';
4
 import { setLoggingConfig } from '../logging';
5
+import { SET_NETWORK_INFO } from '../net-info';
5
 import { PARTICIPANT_LEFT } from '../participants';
6
 import { PARTICIPANT_LEFT } from '../participants';
6
 import { MiddlewareRegistry } from '../redux';
7
 import { MiddlewareRegistry } from '../redux';
7
 
8
 
31
         }
32
         }
32
         break;
33
         break;
33
 
34
 
35
+    case SET_NETWORK_INFO:
36
+        JitsiMeetJS.setNetworkInfo({
37
+            isOnline: action.isOnline
38
+        });
39
+        break;
40
+
34
     case PARTICIPANT_LEFT:
41
     case PARTICIPANT_LEFT:
35
         action.participant.local && store.dispatch(disposeLib());
42
         action.participant.local && store.dispatch(disposeLib());
36
         break;
43
         break;

+ 11
- 0
react/features/base/net-info/selectors.js View File

1
+import { STORE_NAME } from './constants';
2
+
3
+/**
4
+ * A selector for the internet online status.
5
+ *
6
+ * @param {Object} state - The redux state.
7
+ * @returns {boolean}
8
+ */
9
+export function isOnline(state) {
10
+    return state[STORE_NAME].isOnline;
11
+}

Loading…
Cancel
Save