浏览代码

[RN] Make full-screen more resilient on Android (Coding style: consistency)

master
Lyubo Marinov 7 年前
父节点
当前提交
e2cf7a788d

+ 7
- 7
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java 查看文件

416
     }
416
     }
417
 
417
 
418
     /**
418
     /**
419
-     * Handler for focus changes which the window where this view is attached to
420
-     * is experiencing. Here we call into the Immersive mode plugin, so it
421
-     * triggers an event.
419
+     * Called when the window containing this view gains or loses focus.
422
      *
420
      *
423
-     * @param hasFocus - Whether the window / view has focus or not.
421
+     * @param hasFocus If the window of this view now has focus, {@code true};
422
+     * otherwise, {@code false}.
424
      */
423
      */
425
     @Override
424
     @Override
426
     public void onWindowFocusChanged(boolean hasFocus) {
425
     public void onWindowFocusChanged(boolean hasFocus) {
427
         super.onWindowFocusChanged(hasFocus);
426
         super.onWindowFocusChanged(hasFocus);
428
 
427
 
429
-        RNImmersiveModule module = RNImmersiveModule.getInstance();
428
+        // https://github.com/mockingbot/react-native-immersive#restore-immersive-state
429
+        RNImmersiveModule immersive = RNImmersiveModule.getInstance();
430
 
430
 
431
-        if (hasFocus && module != null) {
432
-            module.emitImmersiveStateChangeEvent();
431
+        if (hasFocus && immersive != null) {
432
+            immersive.emitImmersiveStateChangeEvent();
433
         }
433
         }
434
     }
434
     }
435
 
435
 

+ 4
- 4
react/features/base/jwt/reducer.js 查看文件

5
 import { SET_CALLEE_INFO_VISIBLE, SET_JWT } from './actionTypes';
5
 import { SET_CALLEE_INFO_VISIBLE, SET_JWT } from './actionTypes';
6
 
6
 
7
 /**
7
 /**
8
- * The initial redux state of the feature jwt.
8
+ * The default/initial redux state of the feature jwt.
9
  *
9
  *
10
  * @private
10
  * @private
11
  * @type {{
11
  * @type {{
13
  *     isGuest: boolean
13
  *     isGuest: boolean
14
  * }}
14
  * }}
15
  */
15
  */
16
-const _INITIAL_STATE = {
16
+const DEFAULT_STATE = {
17
     /**
17
     /**
18
      * The indicator which determines whether (the) {@code CalleeInfo} is
18
      * The indicator which determines whether (the) {@code CalleeInfo} is
19
      * visible.
19
      * visible.
42
  */
42
  */
43
 ReducerRegistry.register(
43
 ReducerRegistry.register(
44
     'features/base/jwt',
44
     'features/base/jwt',
45
-    (state = _INITIAL_STATE, action) => {
45
+    (state = DEFAULT_STATE, action) => {
46
         switch (action.type) {
46
         switch (action.type) {
47
         case SET_CALLEE_INFO_VISIBLE:
47
         case SET_CALLEE_INFO_VISIBLE:
48
             return set(state, 'calleeInfoVisible', action.calleeInfoVisible);
48
             return set(state, 'calleeInfoVisible', action.calleeInfoVisible);
51
             // eslint-disable-next-line no-unused-vars
51
             // eslint-disable-next-line no-unused-vars
52
             const { type, ...payload } = action;
52
             const { type, ...payload } = action;
53
             const nextState = {
53
             const nextState = {
54
-                ..._INITIAL_STATE,
54
+                ...DEFAULT_STATE,
55
                 ...payload
55
                 ...payload
56
             };
56
             };
57
 
57
 

+ 6
- 4
react/features/base/lib-jitsi-meet/reducer.js 查看文件

1
+// @flow
2
+
1
 import { ReducerRegistry } from '../redux';
3
 import { ReducerRegistry } from '../redux';
2
 
4
 
3
 import {
5
 import {
8
 } from './actionTypes';
10
 } from './actionTypes';
9
 
11
 
10
 /**
12
 /**
11
- * The initial state of the feature base/lib-jitsi-meet.
13
+ * The default/initial redux state of the feature base/lib-jitsi-meet.
12
  *
14
  *
13
  * @type {Object}
15
  * @type {Object}
14
  */
16
  */
15
-const INITIAL_STATE = {};
17
+const DEFAULT_STATE = {};
16
 
18
 
17
 ReducerRegistry.register(
19
 ReducerRegistry.register(
18
     'features/base/lib-jitsi-meet',
20
     'features/base/lib-jitsi-meet',
19
-    (state = INITIAL_STATE, action) => {
21
+    (state = DEFAULT_STATE, action) => {
20
         switch (action.type) {
22
         switch (action.type) {
21
         case LIB_DID_DISPOSE:
23
         case LIB_DID_DISPOSE:
22
-            return INITIAL_STATE;
24
+            return DEFAULT_STATE;
23
 
25
 
24
         case LIB_DID_INIT:
26
         case LIB_DID_INIT:
25
             return {
27
             return {

+ 8
- 6
react/features/base/logging/reducer.js 查看文件

1
+// @flow
2
+
1
 import { equals, ReducerRegistry } from '../redux';
3
 import { equals, ReducerRegistry } from '../redux';
2
 
4
 
3
 import { SET_LOGGING_CONFIG } from './actionTypes';
5
 import { SET_LOGGING_CONFIG } from './actionTypes';
4
 
6
 
5
 /**
7
 /**
6
- * The initial state of the feature base/logging.
8
+ * The default/initial redux state of the feature base/logging.
7
  *
9
  *
8
- * XXX When making any changes to the INITIAL_STATE make sure to also update
10
+ * XXX When making any changes to the DEFAULT_STATE make sure to also update
9
  * logging_config.js file located in the root directory of this project !!!
11
  * logging_config.js file located in the root directory of this project !!!
10
  *
12
  *
11
  * @type {{
13
  * @type {{
12
  *     config: Object
14
  *     config: Object
13
  * }}
15
  * }}
14
  */
16
  */
15
-const INITIAL_STATE = {
17
+const DEFAULT_STATE = {
16
     config: {
18
     config: {
17
         defaultLogLevel: 'trace',
19
         defaultLogLevel: 'trace',
18
 
20
 
26
 
28
 
27
 ReducerRegistry.register(
29
 ReducerRegistry.register(
28
     'features/base/logging',
30
     'features/base/logging',
29
-    (state = INITIAL_STATE, action) => {
31
+    (state = DEFAULT_STATE, action) => {
30
         switch (action.type) {
32
         switch (action.type) {
31
         case SET_LOGGING_CONFIG:
33
         case SET_LOGGING_CONFIG:
32
             return _setLoggingConfig(state, action);
34
             return _setLoggingConfig(state, action);
48
  */
50
  */
49
 function _setLoggingConfig(state, action) {
51
 function _setLoggingConfig(state, action) {
50
     const config = {
52
     const config = {
51
-        // The config of INITIAL_STATE is the default configuration of the
53
+        // The config of DEFAULT_STATE is the default configuration of the
52
         // feature base/logging.
54
         // feature base/logging.
53
-        ...INITIAL_STATE.config,
55
+        ...DEFAULT_STATE.config,
54
         ...action.config
56
         ...action.config
55
     };
57
     };
56
 
58
 

+ 5
- 3
react/features/base/responsive-ui/reducer.js 查看文件

1
+// @flow
2
+
1
 import { ReducerRegistry, set } from '../redux';
3
 import { ReducerRegistry, set } from '../redux';
2
 
4
 
3
 import { SET_ASPECT_RATIO, SET_REDUCED_UI } from './actionTypes';
5
 import { SET_ASPECT_RATIO, SET_REDUCED_UI } from './actionTypes';
4
 import { ASPECT_RATIO_NARROW } from './constants';
6
 import { ASPECT_RATIO_NARROW } from './constants';
5
 
7
 
6
 /**
8
 /**
7
- * The initial redux state of the feature base/responsive-ui.
9
+ * The default/initial redux state of the feature base/responsive-ui.
8
  */
10
  */
9
-const _INITIAL_STATE = {
11
+const DEFAULT_STATE = {
10
     aspectRatio: ASPECT_RATIO_NARROW,
12
     aspectRatio: ASPECT_RATIO_NARROW,
11
     reducedUI: false
13
     reducedUI: false
12
 };
14
 };
13
 
15
 
14
 ReducerRegistry.register(
16
 ReducerRegistry.register(
15
     'features/base/responsive-ui',
17
     'features/base/responsive-ui',
16
-    (state = _INITIAL_STATE, action) => {
18
+    (state = DEFAULT_STATE, action) => {
17
         switch (action.type) {
19
         switch (action.type) {
18
         case SET_ASPECT_RATIO:
20
         case SET_ASPECT_RATIO:
19
             return set(state, 'aspectRatio', action.aspectRatio);
21
             return set(state, 'aspectRatio', action.aspectRatio);

+ 45
- 30
react/features/mobile/background/middleware.js 查看文件

1
-/* @flow */
1
+// @flow
2
 
2
 
3
 import { AppState } from 'react-native';
3
 import { AppState } from 'react-native';
4
 import type { Dispatch } from 'redux';
4
 import type { Dispatch } from 'redux';
5
 
5
 
6
-import {
7
-    APP_WILL_MOUNT,
8
-    APP_WILL_UNMOUNT
9
-} from '../../app';
6
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';
10
 import { MiddlewareRegistry } from '../../base/redux';
7
 import { MiddlewareRegistry } from '../../base/redux';
11
 
8
 
12
 import {
9
 import {
13
-    _setAppStateListener,
10
+    _setAppStateListener as _setAppStateListenerA,
14
     _setBackgroundVideoMuted,
11
     _setBackgroundVideoMuted,
15
     appStateChanged
12
     appStateChanged
16
 } from './actions';
13
 } from './actions';
25
  * required to mute or unmute the local video in case the application goes to
22
  * required to mute or unmute the local video in case the application goes to
26
  * the background or comes back from it.
23
  * the background or comes back from it.
27
  *
24
  *
28
- * @param {Store} store - Redux store.
25
+ * @param {Store} store - The redux store.
29
  * @returns {Function}
26
  * @returns {Function}
30
  * @see {@link https://facebook.github.io/react-native/docs/appstate.html}
27
  * @see {@link https://facebook.github.io/react-native/docs/appstate.html}
31
  */
28
  */
32
 MiddlewareRegistry.register(store => next => action => {
29
 MiddlewareRegistry.register(store => next => action => {
33
     switch (action.type) {
30
     switch (action.type) {
34
-    case _SET_APP_STATE_LISTENER: {
35
-        // Remove the current/old AppState listener.
36
-        const { appStateListener } = store.getState()['features/background'];
37
-
38
-        if (appStateListener) {
39
-            AppState.removeEventListener('change', appStateListener);
40
-        }
41
-
42
-        // Add the new AppState listener.
43
-        if (action.listener) {
44
-            AppState.addEventListener('change', action.listener);
45
-        }
46
-        break;
47
-    }
31
+    case _SET_APP_STATE_LISTENER:
32
+        return _setAppStateListenerF(store, next, action);
48
 
33
 
49
     case APP_STATE_CHANGED:
34
     case APP_STATE_CHANGED:
50
         _appStateChanged(store.dispatch, action.appState);
35
         _appStateChanged(store.dispatch, action.appState);
51
         break;
36
         break;
52
 
37
 
53
-    case APP_WILL_MOUNT:
54
-        store.dispatch(
55
-            _setAppStateListener(
56
-                _onAppStateChange.bind(undefined, store.dispatch)));
38
+    case APP_WILL_MOUNT: {
39
+        const { dispatch } = store;
40
+
41
+        dispatch(
42
+            _setAppStateListenerA(_onAppStateChange.bind(undefined, dispatch)));
57
         break;
43
         break;
44
+    }
58
 
45
 
59
     case APP_WILL_UNMOUNT:
46
     case APP_WILL_UNMOUNT:
60
-        store.dispatch(_setAppStateListener(null));
47
+        store.dispatch(_setAppStateListenerA(undefined));
61
         break;
48
         break;
62
     }
49
     }
63
 
50
 
65
 });
52
 });
66
 
53
 
67
 /**
54
 /**
68
- * Handles app state changes. Dispatches the necessary Redux actions for the
55
+ * Handles app state changes. Dispatches the necessary redux actions for the
69
  * local video to be muted when the app goes to the background, and to be
56
  * local video to be muted when the app goes to the background, and to be
70
  * unmuted when the app comes back.
57
  * unmuted when the app comes back.
71
  *
58
  *
72
- * @param {Dispatch} dispatch - Redux dispatch function.
59
+ * @param {Dispatch} dispatch - The redux {@code dispatch} function.
73
  * @param {string} appState - The current app state.
60
  * @param {string} appState - The current app state.
74
  * @private
61
  * @private
75
  * @returns {void}
62
  * @returns {void}
97
 
84
 
98
 /**
85
 /**
99
  * Called by React Native's AppState API to notify that the application state
86
  * Called by React Native's AppState API to notify that the application state
100
- * has changed. Dispatches the change within the (associated) Redux store.
87
+ * has changed. Dispatches the change within the (associated) redux store.
101
  *
88
  *
102
- * @param {Dispatch} dispatch - Redux dispatch function.
89
+ * @param {Dispatch} dispatch - The redux {@code dispatch} function.
103
  * @param {string} appState - The current application execution state.
90
  * @param {string} appState - The current application execution state.
104
  * @private
91
  * @private
105
  * @returns {void}
92
  * @returns {void}
107
 function _onAppStateChange(dispatch: Dispatch<*>, appState: string) {
94
 function _onAppStateChange(dispatch: Dispatch<*>, appState: string) {
108
     dispatch(appStateChanged(appState));
95
     dispatch(appStateChanged(appState));
109
 }
96
 }
97
+
98
+/**
99
+ * Notifies the feature filmstrip that the action
100
+ * {@link _SET_IMMERSIVE_LISTENER} is being dispatched within a specific redux
101
+ * store.
102
+ *
103
+ * @param {Store} store - The redux store in which the specified action is being
104
+ * dispatched.
105
+ * @param {Dispatch} next - The redux dispatch function to dispatch the
106
+ * specified action to the specified store.
107
+ * @param {Action} action - The redux action {@code _SET_IMMERSIVE_LISTENER}
108
+ * which is being dispatched in the specified store.
109
+ * @private
110
+ * @returns {Object} The value returned by {@code next(action)}.
111
+ */
112
+function _setAppStateListenerF({ getState }, next, action) {
113
+    // Remove the old AppState listener and add the new one.
114
+    const { appStateListener: oldListener } = getState()['features/background'];
115
+    const result = next(action);
116
+    const { appStateListener: newListener } = getState()['features/background'];
117
+
118
+    if (oldListener !== newListener) {
119
+        oldListener && AppState.removeEventListener('change', oldListener);
120
+        newListener && AppState.addEventListener('change', newListener);
121
+    }
122
+
123
+    return result;
124
+}

+ 7
- 2
react/features/mobile/background/reducer.js 查看文件

1
+// @flow
2
+
1
 import { ReducerRegistry } from '../../base/redux';
3
 import { ReducerRegistry } from '../../base/redux';
2
 
4
 
3
 import {
5
 import {
5
     APP_STATE_CHANGED
7
     APP_STATE_CHANGED
6
 } from './actionTypes';
8
 } from './actionTypes';
7
 
9
 
8
-const INITIAL_STATE = {
10
+/**
11
+ * The default/initial redux state of the feature background.
12
+ */
13
+const DEFAULT_STATE = {
9
     appState: 'active'
14
     appState: 'active'
10
 };
15
 };
11
 
16
 
12
 ReducerRegistry.register(
17
 ReducerRegistry.register(
13
     'features/background',
18
     'features/background',
14
-    (state = INITIAL_STATE, action) => {
19
+    (state = DEFAULT_STATE, action) => {
15
         switch (action.type) {
20
         switch (action.type) {
16
         case _SET_APP_STATE_LISTENER:
21
         case _SET_APP_STATE_LISTENER:
17
             return {
22
             return {

+ 2
- 1
react/features/mobile/full-screen/actionTypes.js 查看文件

1
 /**
1
 /**
2
- * The type of redux action to set the Immersive change event listener.
2
+ * The type of (redux) action to set the react-native-immersive's change event
3
+ * listener.
3
  *
4
  *
4
  * {
5
  * {
5
  *     type: _SET_IMMERSIVE_LISTENER,
6
  *     type: _SET_IMMERSIVE_LISTENER,

+ 4
- 3
react/features/mobile/full-screen/actions.js 查看文件

3
 import { _SET_IMMERSIVE_LISTENER } from './actionTypes';
3
 import { _SET_IMMERSIVE_LISTENER } from './actionTypes';
4
 
4
 
5
 /**
5
 /**
6
- * Sets the listener to be used with React Native's Immersive API.
6
+ * Sets the change event listener to be used with react-native-immersive's API.
7
  *
7
  *
8
- * @param {Function} listener - Function to be set as the change event listener.
8
+ * @param {Function} [listener] - The function to be used with
9
+ * react-native-immersive's API as the change event listener.
9
  * @protected
10
  * @protected
10
  * @returns {{
11
  * @returns {{
11
  *     type: _SET_IMMERSIVE_LISTENER,
12
  *     type: _SET_IMMERSIVE_LISTENER,
12
- *     listener: Function
13
+ *     listener: ?Function
13
  * }}
14
  * }}
14
  */
15
  */
15
 export function _setImmersiveListener(listener: ?Function) {
16
 export function _setImmersiveListener(listener: ?Function) {

+ 59
- 39
react/features/mobile/full-screen/middleware.js 查看文件

14
 import { Platform } from '../../base/react';
14
 import { Platform } from '../../base/react';
15
 import { MiddlewareRegistry } from '../../base/redux';
15
 import { MiddlewareRegistry } from '../../base/redux';
16
 
16
 
17
-import { _setImmersiveListener } from './actions';
17
+import { _setImmersiveListener as _setImmersiveListenerA } from './actions';
18
 import { _SET_IMMERSIVE_LISTENER } from './actionTypes';
18
 import { _SET_IMMERSIVE_LISTENER } from './actionTypes';
19
 
19
 
20
 /**
20
 /**
28
  * @param {Store} store - The redux store.
28
  * @param {Store} store - The redux store.
29
  * @returns {Function}
29
  * @returns {Function}
30
  */
30
  */
31
-MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
32
-    const result = next(action);
33
-
34
-    let fullScreen = null;
35
-
31
+MiddlewareRegistry.register(store => next => action => {
36
     switch (action.type) {
32
     switch (action.type) {
37
     case _SET_IMMERSIVE_LISTENER:
33
     case _SET_IMMERSIVE_LISTENER:
38
-        // XXX The React Native module Immersive is only implemented on Android
39
-        // and throws on other platforms.
40
-        if (Platform.OS === 'android') {
41
-            // Remove the current/old Immersive listener.
42
-            const { listener } = getState()['features/full-screen'];
43
-
44
-            listener && Immersive.removeImmersiveListener(listener);
45
-
46
-            // Add the new listener.
47
-            action.listener && Immersive.addImmersiveListener(action.listener);
48
-        }
49
-        break;
34
+        return _setImmersiveListenerF(store, next, action);
50
 
35
 
51
     case APP_WILL_MOUNT: {
36
     case APP_WILL_MOUNT: {
52
-        const context = {
53
-            dispatch,
54
-            getState
55
-        };
37
+        const result = next(action);
56
 
38
 
57
-        dispatch(
58
-            _setImmersiveListener(_onImmersiveChange.bind(undefined, context)));
59
-        break;
39
+        store.dispatch(
40
+            _setImmersiveListenerA(_onImmersiveChange.bind(undefined, store)));
41
+
42
+        return result;
60
     }
43
     }
44
+
61
     case APP_WILL_UNMOUNT:
45
     case APP_WILL_UNMOUNT:
62
-        _setImmersiveListener(undefined);
46
+        store.dispatch(_setImmersiveListenerA(undefined));
63
         break;
47
         break;
64
 
48
 
65
     case CONFERENCE_WILL_JOIN:
49
     case CONFERENCE_WILL_JOIN:
66
     case CONFERENCE_JOINED:
50
     case CONFERENCE_JOINED:
67
     case SET_AUDIO_ONLY: {
51
     case SET_AUDIO_ONLY: {
52
+        const result = next(action);
68
         const { audioOnly, conference, joining }
53
         const { audioOnly, conference, joining }
69
-            = getState()['features/base/conference'];
54
+            = store.getState()['features/base/conference'];
70
 
55
 
71
-        fullScreen = conference || joining ? !audioOnly : false;
72
-        break;
56
+        _setFullScreen(conference || joining ? !audioOnly : false);
57
+
58
+        return result;
73
     }
59
     }
74
 
60
 
75
     case CONFERENCE_FAILED:
61
     case CONFERENCE_FAILED:
76
-    case CONFERENCE_LEFT:
77
-        fullScreen = false;
78
-        break;
79
-    }
62
+    case CONFERENCE_LEFT: {
63
+        const result = next(action);
80
 
64
 
81
-    fullScreen !== null && _setFullScreen(fullScreen);
65
+        _setFullScreen(false);
82
 
66
 
83
-    return result;
67
+        return result;
68
+    }
69
+    }
70
+
71
+    return next(action);
84
 });
72
 });
85
 
73
 
86
 /**
74
 /**
119
     // throws on other platforms.
107
     // throws on other platforms.
120
     if (Platform.OS === 'android') {
108
     if (Platform.OS === 'android') {
121
         fullScreen ? Immersive.on() : Immersive.off();
109
         fullScreen ? Immersive.on() : Immersive.off();
110
+    } else {
111
+        // On platforms other than Android go with whatever React Native itself
112
+        // supports.
113
+        StatusBar.setHidden(fullScreen, 'slide');
114
+    }
115
+}
116
+
117
+/**
118
+ * Notifies the feature filmstrip that the action
119
+ * {@link _SET_IMMERSIVE_LISTENER} is being dispatched within a specific redux
120
+ * store.
121
+ *
122
+ * @param {Store} store - The redux store in which the specified action is being
123
+ * dispatched.
124
+ * @param {Dispatch} next - The redux dispatch function to dispatch the
125
+ * specified action to the specified store.
126
+ * @param {Action} action - The redux action {@code _SET_IMMERSIVE_LISTENER}
127
+ * which is being dispatched in the specified store.
128
+ * @private
129
+ * @returns {Object} The value returned by {@code next(action)}.
130
+ */
131
+function _setImmersiveListenerF({ getState }, next, action) {
132
+    // XXX The React Native module Immersive is only implemented on Android and
133
+    // throws on other platforms.
134
+    if (Platform.OS === 'android') {
135
+        // Remove the old Immersive listener and add the new one.
136
+        const { listener: oldListener } = getState()['features/full-screen'];
137
+        const result = next(action);
138
+        const { listener: newListener } = getState()['features/full-screen'];
139
+
140
+        if (oldListener !== newListener) {
141
+            oldListener && Immersive.removeImmersiveListener(oldListener);
142
+            newListener && Immersive.addImmersiveListener(newListener);
143
+        }
122
 
144
 
123
-        return;
145
+        return result;
124
     }
146
     }
125
 
147
 
126
-    // On platforms other than Android go with whatever React Native itself
127
-    // supports.
128
-    StatusBar.setHidden(fullScreen, 'slide');
148
+    return next(action);
129
 }
149
 }

+ 12
- 16
react/features/mobile/full-screen/reducer.js 查看文件

1
+// @flow
2
+
1
 import { ReducerRegistry } from '../../base/redux';
3
 import { ReducerRegistry } from '../../base/redux';
2
 
4
 
3
 import { _SET_IMMERSIVE_LISTENER } from './actionTypes';
5
 import { _SET_IMMERSIVE_LISTENER } from './actionTypes';
4
 
6
 
5
-const INITIAL_STATE = {
6
-    listener: undefined
7
-};
8
-
9
-ReducerRegistry.register(
10
-    'features/full-screen',
11
-    (state = INITIAL_STATE, action) => {
12
-        switch (action.type) {
13
-        case _SET_IMMERSIVE_LISTENER:
14
-            return {
15
-                ...state,
16
-                listener: action.listener
17
-            };
18
-        }
7
+ReducerRegistry.register('features/full-screen', (state = {}, action) => {
8
+    switch (action.type) {
9
+    case _SET_IMMERSIVE_LISTENER:
10
+        return {
11
+            ...state,
12
+            listener: action.listener
13
+        };
14
+    }
19
 
15
 
20
-        return state;
21
-    });
16
+    return state;
17
+});

+ 5
- 5
react/features/mobile/network-activity/reducer.js 查看文件

1
-/* @flow */
1
+// @flow
2
 
2
 
3
 import { ReducerRegistry, set } from '../../base/redux';
3
 import { ReducerRegistry, set } from '../../base/redux';
4
 
4
 
9
 } from './actionTypes';
9
 } from './actionTypes';
10
 
10
 
11
 /**
11
 /**
12
- * The initial redux state of the feature network-activity.
12
+ * The default/initial redux state of the feature network-activity.
13
  *
13
  *
14
  * @type {{
14
  * @type {{
15
  *     requests: Map
15
  *     requests: Map
16
  * }}
16
  * }}
17
  */
17
  */
18
-const _INITIAL_STATE = {
18
+const DEFAULT_STATE = {
19
     /**
19
     /**
20
      * The ongoing network requests i.e. the network request which have been
20
      * The ongoing network requests i.e. the network request which have been
21
      * added to the redux store/state and have not been removed.
21
      * added to the redux store/state and have not been removed.
27
 
27
 
28
 ReducerRegistry.register(
28
 ReducerRegistry.register(
29
     'features/network-activity',
29
     'features/network-activity',
30
-    (state = _INITIAL_STATE, action) => {
30
+    (state = DEFAULT_STATE, action) => {
31
         switch (action.type) {
31
         switch (action.type) {
32
         case _ADD_NETWORK_REQUEST: {
32
         case _ADD_NETWORK_REQUEST: {
33
             const {
33
             const {
44
         }
44
         }
45
 
45
 
46
         case _REMOVE_ALL_NETWORK_REQUESTS:
46
         case _REMOVE_ALL_NETWORK_REQUESTS:
47
-            return set(state, 'requests', _INITIAL_STATE.requests);
47
+            return set(state, 'requests', DEFAULT_STATE.requests);
48
 
48
 
49
         case _REMOVE_NETWORK_REQUEST: {
49
         case _REMOVE_NETWORK_REQUEST: {
50
             const { request: key } = action;
50
             const { request: key } = action;

正在加载...
取消
保存