Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

android: remove ReactContextUtils

Saúl Ibarra Corretgé53722fd2e625
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java
index 18af5dd9a7..702618ff51 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java
@@ -332,8 +332,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
Log.d(TAG, "onDisconnect " + getCallUUID());
WritableNativeMap data = new WritableNativeMap();
data.putString("callUUID", getCallUUID());
- ReactContextUtils.emitEvent(
- null,
+ ReactInstanceManagerHolder.emitEvent(
"org.jitsi.meet:features/connection_service#disconnect",
data);
// The JavaScript side will not go back to the native with
@@ -353,8 +352,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
Log.d(TAG, "onAbort " + getCallUUID());
WritableNativeMap data = new WritableNativeMap();
data.putString("callUUID", getCallUUID());
- ReactContextUtils.emitEvent(
- null,
+ ReactInstanceManagerHolder.emitEvent(
"org.jitsi.meet:features/connection_service#abort",
data);
// The JavaScript side will not go back to the native with
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactContextUtils.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactContextUtils.java
deleted file mode 100644
index da4fc35e8a..0000000000
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactContextUtils.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright @ 2017-present Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jitsi.meet.sdk;
-
-import android.support.annotation.Nullable;
-
-import com.facebook.react.bridge.ReactContext;
-import com.facebook.react.modules.core.DeviceEventManagerModule;
-
-public class ReactContextUtils {
- public static boolean emitEvent(
- ReactContext reactContext,
- String eventName,
- @Nullable Object data) {
- if (reactContext == null) {
- // XXX If no ReactContext is specified, emit through the
- // ReactContext of ReactInstanceManager. ReactInstanceManager
- // cooperates with ReactContextUtils i.e. ReactInstanceManager will
- // not invoke ReactContextUtils without a ReactContext.
- return ReactInstanceManagerHolder.emitEvent(eventName, data);
- }
-
- reactContext
- .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
- .emit(eventName, data);
-
- return true;
- }
-}
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java
index 79400910be..f32d85d109 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java
@@ -24,6 +24,7 @@ import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.common.LifecycleState;
+import com.facebook.react.modules.core.DeviceEventManagerModule;
import java.util.ArrayList;
import java.util.Arrays;
@@ -81,12 +82,13 @@ class ReactInstanceManagerHolder {
ReactContext reactContext
= reactInstanceManager.getCurrentReactContext();
- return
- reactContext != null
- && ReactContextUtils.emitEvent(
- reactContext,
- eventName,
- data);
+ if (reactContext != null) {
+ reactContext
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
+ .emit(eventName, data);
+
+ return true;
+ }
}
return false;