|
@@ -1,5 +1,9 @@
|
1
|
1
|
import { CONFERENCE_FAILED } from '../base/conference';
|
2
|
|
-import { CONNECTION_ESTABLISHED, CONNECTION_FAILED } from '../base/connection';
|
|
2
|
+import {
|
|
3
|
+ CONNECTION_ESTABLISHED,
|
|
4
|
+ CONNECTION_FAILED,
|
|
5
|
+ CONNECTION_WILL_CONNECT
|
|
6
|
+} from '../base/connection';
|
3
|
7
|
import {
|
4
|
8
|
isFatalJitsiConnectionError,
|
5
|
9
|
JitsiConferenceErrors,
|
|
@@ -15,7 +19,7 @@ import {
|
15
|
19
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
16
|
20
|
|
17
|
21
|
/**
|
18
|
|
- * Reduces the Redux actions of the feature overlay.
|
|
22
|
+ * Reduces the redux actions of the feature overlay.
|
19
|
23
|
*/
|
20
|
24
|
ReducerRegistry.register('features/overlay', (state = {}, action) => {
|
21
|
25
|
switch (action.type) {
|
|
@@ -28,6 +32,9 @@ ReducerRegistry.register('features/overlay', (state = {}, action) => {
|
28
|
32
|
case CONNECTION_FAILED:
|
29
|
33
|
return _connectionFailed(state, action);
|
30
|
34
|
|
|
35
|
+ case CONNECTION_WILL_CONNECT:
|
|
36
|
+ return _connectionWillConnect(state, action);
|
|
37
|
+
|
31
|
38
|
case MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED:
|
32
|
39
|
return _mediaPermissionPromptVisibilityChanged(state, action);
|
33
|
40
|
|
|
@@ -39,13 +46,13 @@ ReducerRegistry.register('features/overlay', (state = {}, action) => {
|
39
|
46
|
});
|
40
|
47
|
|
41
|
48
|
/**
|
42
|
|
- * Reduces a specific Redux action CONFERENCE_FAILED of the feature overlay.
|
|
49
|
+ * Reduces a specific redux action CONFERENCE_FAILED of the feature overlay.
|
43
|
50
|
*
|
44
|
|
- * @param {Object} state - The Redux state of the feature overlay.
|
45
|
|
- * @param {Action} action - The Redux action CONFERENCE_FAILED to reduce.
|
|
51
|
+ * @param {Object} state - The redux state of the feature overlay.
|
|
52
|
+ * @param {Action} action - The redux action CONFERENCE_FAILED to reduce.
|
|
53
|
+ * @private
|
46
|
54
|
* @returns {Object} The new state of the feature overlay after the reduction of
|
47
|
55
|
* the specified action.
|
48
|
|
- * @private
|
49
|
56
|
*/
|
50
|
57
|
function _conferenceFailed(state, { error, message }) {
|
51
|
58
|
if (error === JitsiConferenceErrors.FOCUS_LEFT
|
|
@@ -61,30 +68,30 @@ function _conferenceFailed(state, { error, message }) {
|
61
|
68
|
}
|
62
|
69
|
|
63
|
70
|
/**
|
64
|
|
- * Reduces a specific Redux action CONNECTION_ESTABLISHED of the feature
|
|
71
|
+ * Reduces a specific redux action CONNECTION_ESTABLISHED of the feature
|
65
|
72
|
* overlay.
|
66
|
73
|
*
|
67
|
|
- * @param {Object} state - The Redux state of the feature overlay.
|
|
74
|
+ * @param {Object} state - The redux state of the feature overlay.
|
|
75
|
+ * @private
|
68
|
76
|
* @returns {Object} The new state of the feature overlay after the reduction of
|
69
|
77
|
* the specified action.
|
70
|
|
- * @private
|
71
|
78
|
*/
|
72
|
79
|
function _connectionEstablished(state) {
|
73
|
80
|
return set(state, 'connectionEstablished', true);
|
74
|
81
|
}
|
75
|
82
|
|
76
|
83
|
/**
|
77
|
|
- * Reduces a specific Redux action CONNECTION_FAILED of the feature overlay.
|
|
84
|
+ * Reduces a specific redux action CONNECTION_FAILED of the feature overlay.
|
78
|
85
|
*
|
79
|
|
- * @param {Object} state - The Redux state of the feature overlay.
|
80
|
|
- * @param {Action} action - The Redux action CONNECTION_FAILED to reduce.
|
|
86
|
+ * @param {Object} state - The redux state of the feature overlay.
|
|
87
|
+ * @param {Action} action - The redux action CONNECTION_FAILED to reduce.
|
|
88
|
+ * @private
|
81
|
89
|
* @returns {Object} The new state of the feature overlay after the reduction of
|
82
|
90
|
* the specified action.
|
83
|
|
- * @private
|
84
|
91
|
*/
|
85
|
92
|
function _connectionFailed(state, { error, message }) {
|
86
|
93
|
if (isFatalJitsiConnectionError(error)) {
|
87
|
|
- logger.error(`XMPP connection error: ${message}`);
|
|
94
|
+ logger.error(`FATAL XMPP connection error: ${message}`);
|
88
|
95
|
|
89
|
96
|
return assign(state, {
|
90
|
97
|
haveToReload: true,
|
|
@@ -101,14 +108,35 @@ function _connectionFailed(state, { error, message }) {
|
101
|
108
|
}
|
102
|
109
|
|
103
|
110
|
/**
|
104
|
|
- * Reduces a specific Redux action MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED of
|
|
111
|
+ * Reduces a specific redux action CONNECTION_WILL_CONNECT in the feature
|
|
112
|
+ * overlay. Clears the redux state related to the XMPP connection's status.
|
|
113
|
+ *
|
|
114
|
+ * @param {Object} state - The redux state of the feature overlay.
|
|
115
|
+ * @param {Action} action - The redux action to reduce.
|
|
116
|
+ * @private
|
|
117
|
+ * @returns {Object} The new state of the feature overlay after reducing the
|
|
118
|
+ * specified <tt>action</tt> in the feature overlay.
|
|
119
|
+ */
|
|
120
|
+function _connectionWillConnect(
|
|
121
|
+ state,
|
|
122
|
+ action) { // eslint-disable-line no-unused-vars
|
|
123
|
+ return assign(state, {
|
|
124
|
+ connectionEstablished: undefined,
|
|
125
|
+ haveToReload: undefined,
|
|
126
|
+ isNetworkFailure: undefined,
|
|
127
|
+ reason: undefined
|
|
128
|
+ });
|
|
129
|
+}
|
|
130
|
+
|
|
131
|
+/**
|
|
132
|
+ * Reduces a specific redux action MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED of
|
105
|
133
|
* the feature overlay.
|
106
|
134
|
*
|
107
|
|
- * @param {Object} state - The Redux state of the feature overlay.
|
108
|
|
- * @param {Action} action - The Redux action to reduce.
|
|
135
|
+ * @param {Object} state - The redux state of the feature overlay.
|
|
136
|
+ * @param {Action} action - The redux action to reduce.
|
|
137
|
+ * @private
|
109
|
138
|
* @returns {Object} The new state of the feature overlay after the reduction of
|
110
|
139
|
* the specified action.
|
111
|
|
- * @private
|
112
|
140
|
*/
|
113
|
141
|
function _mediaPermissionPromptVisibilityChanged(state, action) {
|
114
|
142
|
return assign(state, {
|
|
@@ -118,12 +146,12 @@ function _mediaPermissionPromptVisibilityChanged(state, action) {
|
118
|
146
|
}
|
119
|
147
|
|
120
|
148
|
/**
|
121
|
|
- * Reduces a specific Redux action SUSPEND_DETECTED of the feature overlay.
|
|
149
|
+ * Reduces a specific redux action SUSPEND_DETECTED of the feature overlay.
|
122
|
150
|
*
|
123
|
|
- * @param {Object} state - The Redux state of the feature overlay.
|
|
151
|
+ * @param {Object} state - The redux state of the feature overlay.
|
|
152
|
+ * @private
|
124
|
153
|
* @returns {Object} The new state of the feature overlay after the reduction of
|
125
|
154
|
* the specified action.
|
126
|
|
- * @private
|
127
|
155
|
*/
|
128
|
156
|
function _suspendDetected(state) {
|
129
|
157
|
return set(state, 'suspendDetected', true);
|