|
@@ -1,8 +1,5 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
|
-import { NativeModules } from 'react-native';
|
4
|
|
-
|
5
|
|
-import { getAppProp } from '../../base/app';
|
6
|
3
|
import {
|
7
|
4
|
CONFERENCE_FAILED,
|
8
|
5
|
CONFERENCE_JOINED,
|
|
@@ -20,6 +17,8 @@ import { MiddlewareRegistry } from '../../base/redux';
|
20
|
17
|
import { getSymbolDescription, toURLString } from '../../base/util';
|
21
|
18
|
import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
|
22
|
19
|
|
|
20
|
+import { sendEvent } from './functions';
|
|
21
|
+
|
23
|
22
|
/**
|
24
|
23
|
* Middleware that captures Redux actions and uses the ExternalAPI module to
|
25
|
24
|
* turn them into native events so the application knows about them.
|
|
@@ -66,13 +65,13 @@ MiddlewareRegistry.register(store => next => action => {
|
66
|
65
|
break;
|
67
|
66
|
|
68
|
67
|
case ENTER_PICTURE_IN_PICTURE:
|
69
|
|
- _sendEvent(store, getSymbolDescription(type), /* data */ {});
|
|
68
|
+ sendEvent(store, getSymbolDescription(type), /* data */ {});
|
70
|
69
|
break;
|
71
|
70
|
|
72
|
71
|
case LOAD_CONFIG_ERROR: {
|
73
|
72
|
const { error, locationURL } = action;
|
74
|
73
|
|
75
|
|
- _sendEvent(
|
|
74
|
+ sendEvent(
|
76
|
75
|
store,
|
77
|
76
|
getSymbolDescription(type),
|
78
|
77
|
/* data */ {
|
|
@@ -128,7 +127,7 @@ function _maybeTriggerEarlyConferenceWillJoin(store, action) {
|
128
|
127
|
const { locationURL } = store.getState()['features/base/connection'];
|
129
|
128
|
const { room } = action;
|
130
|
129
|
|
131
|
|
- isRoomValid(room) && locationURL && _sendEvent(
|
|
130
|
+ isRoomValid(room) && locationURL && sendEvent(
|
132
|
131
|
store,
|
133
|
132
|
getSymbolDescription(CONFERENCE_WILL_JOIN),
|
134
|
133
|
/* data */ {
|
|
@@ -161,7 +160,7 @@ function _sendConferenceEvent(
|
161
|
160
|
}
|
162
|
161
|
|
163
|
162
|
_swallowEvent(store, action, data)
|
164
|
|
- || _sendEvent(store, getSymbolDescription(type), data);
|
|
163
|
+ || sendEvent(store, getSymbolDescription(type), data);
|
165
|
164
|
}
|
166
|
165
|
|
167
|
166
|
/**
|
|
@@ -185,7 +184,7 @@ function _sendConferenceFailedOnConnectionError(store, action) {
|
185
|
184
|
// If there's any conference in the base/conference state then the
|
186
|
185
|
// base/conference feature is supposed to emit a failure.
|
187
|
186
|
conference => conference.getConnection() !== connection)
|
188
|
|
- && _sendEvent(
|
|
187
|
+ && sendEvent(
|
189
|
188
|
store,
|
190
|
189
|
getSymbolDescription(CONFERENCE_FAILED),
|
191
|
190
|
/* data */ {
|
|
@@ -194,28 +193,6 @@ function _sendConferenceFailedOnConnectionError(store, action) {
|
194
|
193
|
});
|
195
|
194
|
}
|
196
|
195
|
|
197
|
|
-/**
|
198
|
|
- * Sends a specific event to the native counterpart of the External API. Native
|
199
|
|
- * apps may listen to such events via the mechanisms provided by the (native)
|
200
|
|
- * mobile Jitsi Meet SDK.
|
201
|
|
- *
|
202
|
|
- * @param {Object} store - The redux store.
|
203
|
|
- * @param {string} name - The name of the event to send.
|
204
|
|
- * @param {Object} data - The details/specifics of the event to send determined
|
205
|
|
- * by/associated with the specified {@code name}.
|
206
|
|
- * @private
|
207
|
|
- * @returns {void}
|
208
|
|
- */
|
209
|
|
-function _sendEvent(store: Object, name: string, data: Object) {
|
210
|
|
- // The JavaScript App needs to provide uniquely identifying information to
|
211
|
|
- // the native ExternalAPI module so that the latter may match the former to
|
212
|
|
- // the native JitsiMeetView which hosts it.
|
213
|
|
- const externalAPIScope = getAppProp(store, 'externalAPIScope');
|
214
|
|
-
|
215
|
|
- externalAPIScope
|
216
|
|
- && NativeModules.ExternalAPI.sendEvent(name, data, externalAPIScope);
|
217
|
|
-}
|
218
|
|
-
|
219
|
196
|
/**
|
220
|
197
|
* Determines whether to not send a {@code CONFERENCE_LEFT} event to the native
|
221
|
198
|
* counterpart of the External API.
|