|
@@ -8,7 +8,9 @@ import {
|
8
|
8
|
CONFERENCE_LEFT,
|
9
|
9
|
CONFERENCE_WILL_JOIN,
|
10
|
10
|
CONFERENCE_WILL_LEAVE,
|
11
|
|
- JITSI_CONFERENCE_URL_KEY
|
|
11
|
+ JITSI_CONFERENCE_URL_KEY,
|
|
12
|
+ SET_ROOM,
|
|
13
|
+ isRoomValid
|
12
|
14
|
} from '../../base/conference';
|
13
|
15
|
import { LOAD_CONFIG_ERROR } from '../../base/config';
|
14
|
16
|
import { MiddlewareRegistry } from '../../base/redux';
|
|
@@ -67,6 +69,10 @@ MiddlewareRegistry.register(store => next => action => {
|
67
|
69
|
});
|
68
|
70
|
break;
|
69
|
71
|
}
|
|
72
|
+
|
|
73
|
+ case SET_ROOM:
|
|
74
|
+ _maybeTriggerEarlyConferenceWillJoin(store, action);
|
|
75
|
+ break;
|
70
|
76
|
}
|
71
|
77
|
|
72
|
78
|
return result;
|
|
@@ -115,6 +121,32 @@ function _getSymbolDescription(symbol: Symbol) {
|
115
|
121
|
return description;
|
116
|
122
|
}
|
117
|
123
|
|
|
124
|
+/**
|
|
125
|
+ * If {@link SET_ROOM} action happens for a valid conference room this method
|
|
126
|
+ * will emit an early {@link CONFERENCE_WILL_JOIN} event to let the external API
|
|
127
|
+ * know that a conference is being joined. Before that happens a connection must
|
|
128
|
+ * be created and only then base/conference feature would emit
|
|
129
|
+ * {@link CONFERENCE_WILL_JOIN}. That is fine for the Jitsi Meet app, because
|
|
130
|
+ * that's the a conference instance gets created, but it's too late for
|
|
131
|
+ * the external API to learn that. The latter {@link CONFERENCE_WILL_JOIN} is
|
|
132
|
+ * swallowed in {@link _swallowEvent}.
|
|
133
|
+ *
|
|
134
|
+ * @param {Store} store - The redux store.
|
|
135
|
+ * @param {Action} action - The redux action.
|
|
136
|
+ * @returns {void}
|
|
137
|
+ */
|
|
138
|
+function _maybeTriggerEarlyConferenceWillJoin(store, action) {
|
|
139
|
+ const { locationURL } = store.getState()['features/base/connection'];
|
|
140
|
+ const { room } = action;
|
|
141
|
+
|
|
142
|
+ isRoomValid(room) && locationURL && _sendEvent(
|
|
143
|
+ store,
|
|
144
|
+ _getSymbolDescription(CONFERENCE_WILL_JOIN),
|
|
145
|
+ /* data */ {
|
|
146
|
+ url: toURLString(locationURL)
|
|
147
|
+ });
|
|
148
|
+}
|
|
149
|
+
|
118
|
150
|
/**
|
119
|
151
|
* Sends an event to the native counterpart of the External API for a specific
|
120
|
152
|
* conference-related redux action.
|
|
@@ -232,6 +264,11 @@ function _swallowEvent(store, action, data) {
|
232
|
264
|
switch (action.type) {
|
233
|
265
|
case CONFERENCE_LEFT:
|
234
|
266
|
return _swallowConferenceLeft(store, action, data);
|
|
267
|
+ case CONFERENCE_WILL_JOIN:
|
|
268
|
+ // CONFERENCE_WILL_JOIN is dispatched to the external API on SET_ROOM,
|
|
269
|
+ // before the connection is created, so we need to swallow the original
|
|
270
|
+ // one emitted by base/conference.
|
|
271
|
+ return true;
|
235
|
272
|
|
236
|
273
|
default:
|
237
|
274
|
return false;
|