diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/BaseReactView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/BaseReactView.java deleted file mode 100644 index 20000e2622..0000000000 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/BaseReactView.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright @ 2018-present 8x8, Inc. - * Copyright @ 2018 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.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.util.AttributeSet; -import android.widget.FrameLayout; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.facebook.react.ReactRootView; -import com.facebook.react.bridge.ReadableMap; -import com.rnimmersive.RNImmersiveModule; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.WeakHashMap; - -/** - * Base class for all views which are backed by a React Native view. - */ -public abstract class BaseReactView - extends FrameLayout { - - /** - * Background color used by {@code BaseReactView} and the React Native root - * view. - */ - protected static int BACKGROUND_COLOR = 0xFF111111; - - /** - * The collection of all existing {@code BaseReactView}s. Used to find the - * {@code BaseReactView} when delivering events coming from - * {@link ExternalAPIModule}. - */ - static final Set views - = Collections.newSetFromMap(new WeakHashMap()); - - /** - * Finds a {@code BaseReactView} which matches a specific external API - * scope. - * - * @param externalAPIScope - The external API scope associated with the - * {@code BaseReactView} to find. - * @return The {@code BaseReactView}, if any, associated with the specified - * {@code externalAPIScope}; otherwise, {@code null}. - */ - public static BaseReactView findViewByExternalAPIScope( - String externalAPIScope) { - synchronized (views) { - for (BaseReactView view : views) { - if (view.externalAPIScope.equals(externalAPIScope)) { - return view; - } - } - } - - return null; - } - - /** - * Gets all registered React views. - * - * @return An {@link ArrayList} containing all views currently held by React. - */ - static ArrayList getViews() { - return new ArrayList<>(views); - } - - /** - * The unique identifier of this {@code BaseReactView} within the process - * for the purposes of {@link ExternalAPIModule}. The name scope was - * inspired by postis which we use on Web for the similar purposes of the - * iframe-based external API. - */ - protected String externalAPIScope; - - /** - * The listener (e.g. {@link JitsiMeetViewListener}) instance for reporting - * events occurring in Jitsi Meet. - */ - @Deprecated - private ListenerT listener; - - /** - * React Native root view. - */ - private ReactRootView reactRootView; - - public BaseReactView(@NonNull Context context) { - super(context); - initialize((Activity)context); - } - - public BaseReactView(Context context, AttributeSet attrs) { - super(context, attrs); - initialize((Activity)context); - } - - public BaseReactView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - initialize((Activity)context); - } - - /** - * Creates the {@code ReactRootView} for the given app name with the given - * props. Once created it's set as the view of this {@code FrameLayout}. - * - * @param appName - The name of the "app" (in React Native terms) to load. - * @param props - The React Component props to pass to the app. - */ - public void createReactRootView(String appName, @Nullable Bundle props) { - if (props == null) { - props = new Bundle(); - } - - props.putString("externalAPIScope", externalAPIScope); - - if (reactRootView == null) { - reactRootView = new ReactRootView(getContext()); - reactRootView.startReactApplication( - ReactInstanceManagerHolder.getReactInstanceManager(), - appName, - props); - reactRootView.setBackgroundColor(BACKGROUND_COLOR); - addView(reactRootView); - } else { - reactRootView.setAppProperties(props); - } - } - - /** - * Releases the React resources (specifically the {@link ReactRootView}) - * associated with this view. - * - * MUST be called when the {@link Activity} holding this view is destroyed, - * typically in the {@code onDestroy} method. - */ - public void dispose() { - if (reactRootView != null) { - removeView(reactRootView); - reactRootView.unmountReactApplication(); - reactRootView = null; - } - } - - /** - * Gets the listener set on this {@code BaseReactView}. - * - * @return The listener set on this {@code BaseReactView}. - */ - @Deprecated - public ListenerT getListener() { - return listener; - } - - /** - * Abstract method called by {@link ExternalAPIModule} when an event is - * received for this view. - * - * @param name - The name of the event. - * @param data - The details of the event associated with/specific to the - * specified {@code name}. - */ - @Deprecated - protected abstract void onExternalAPIEvent(String name, ReadableMap data); - - @Deprecated - protected void onExternalAPIEvent( - Map listenerMethods, - String name, ReadableMap data) { - ListenerT listener = getListener(); - - if (listener != null) { - ListenerUtils.runListenerMethod( - listener, listenerMethods, name, data); - } - } - - /** - * Called when the window containing this view gains or loses focus. - * - * @param hasFocus If the window of this view now has focus, {@code true}; - * otherwise, {@code false}. - */ - @Override - public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); - - // https://github.com/mockingbot/react-native-immersive#restore-immersive-state - RNImmersiveModule immersive = RNImmersiveModule.getInstance(); - - if (hasFocus && immersive != null) { - immersive.emitImmersiveStateChangeEvent(); - } - } - - /** - * Sets a specific listener on this {@code BaseReactView}. - * - * @param listener The listener to set on this {@code BaseReactView}. - */ - @Deprecated - public void setListener(ListenerT listener) { - this.listener = listener; - } - - private void initialize(Activity activity) { - setBackgroundColor(BACKGROUND_COLOR); - - ReactInstanceManagerHolder.initReactInstanceManager(activity); - - // Hook this BaseReactView into ExternalAPI. - externalAPIScope = UUID.randomUUID().toString(); - synchronized (views) { - views.add(this); - } - } -} diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java index 7ed18abe72..325c2c8229 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java @@ -102,31 +102,18 @@ class ExternalAPIModule extends ReactContextBaseJavaModule { /** * Dispatches an event that occurred on the JavaScript side of the SDK to - * the specified {@link BaseReactView}'s listener. + * the native side. * * @param name The name of the event. * @param data The details/specifics of the event to send determined * by/associated with the specified {@code name}. - * @param scope */ @ReactMethod - public void sendEvent(String name, ReadableMap data, String scope) { + public void sendEvent(String name, ReadableMap data) { // Keep track of the current ongoing conference. OngoingConferenceTracker.getInstance().onExternalAPIEvent(name, data); - // The JavaScript App needs to provide uniquely identifying information - // to the native ExternalAPI module so that the latter may match the - // former to the native BaseReactView which hosts it. - BaseReactView view = BaseReactView.findViewByExternalAPIScope(scope); - - if (view != null) { - JitsiMeetLogger.d(TAG + " Sending event: " + name + " with data: " + data); - try { - view.onExternalAPIEvent(name, data); - broadcastEmitter.sendBroadcast(name, data); - } catch (Exception e) { - JitsiMeetLogger.e(e, TAG + " onExternalAPIEvent: error sending event"); - } - } + JitsiMeetLogger.d(TAG + " Sending event: " + name + " with data: " + data); + broadcastEmitter.sendBroadcast(name, data); } } diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java index d211e139c5..e1a6d56b9c 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java @@ -167,12 +167,9 @@ public class JitsiMeetActivity extends AppCompatActivity } } - public void leave() { - if (this.jitsiView != null) { - this.jitsiView .leave(); - } else { - JitsiMeetLogger.w("Cannot leave, view is null"); - } + protected void leave() { + Intent hangupBroadcastIntent = BroadcastIntentHelper.buildHangUpIntent(); + LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(hangupBroadcastIntent); } private @Nullable diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java deleted file mode 100644 index c6dff7f72e..0000000000 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright @ 2019-present 8x8, Inc. - * Copyright @ 2017-2018 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.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -/** - * Base {@link Fragment} for applications integrating Jitsi Meet at a higher level. It - * contains all the required wiring between the {@code JitsiMeetView} and - * the Fragment lifecycle methods already implemented. - * - * In this fragment we use a single {@code JitsiMeetView} instance. This - * instance gives us access to a view which displays the welcome page and the - * conference itself. All lifecycle methods associated with this Fragment are - * hooked to the React Native subsystem via proxy calls through the - * {@code JitsiMeetActivityDelegate} static methods. - * - * @deprecated use {@link JitsiMeetActivity} or directly {@link JitsiMeetView} - */ -@Deprecated -public class JitsiMeetFragment extends Fragment { - - /** - * Instance of the {@link JitsiMeetView} which this activity will display. - */ - private JitsiMeetView view; - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, - @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { - return this.view = new JitsiMeetView(getActivity()); - } - - public JitsiMeetView getJitsiView() { - return view; - } - - @Override - public void onDestroy() { - super.onDestroy(); - - JitsiMeetActivityDelegate.onHostDestroy(getActivity()); - } - - @Override - public void onResume() { - super.onResume(); - - JitsiMeetActivityDelegate.onHostResume(getActivity()); - } - - @Override - public void onStop() { - super.onStop(); - - JitsiMeetActivityDelegate.onHostPause(getActivity()); - } -} diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java index 36a2fa0b15..b2ed69a4b5 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java @@ -16,36 +16,33 @@ package org.jitsi.meet.sdk; +import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.util.AttributeSet; +import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.ReactRootView; +import com.rnimmersive.RNImmersiveModule; import org.jitsi.meet.sdk.log.JitsiMeetLogger; -import java.lang.reflect.Method; -import java.util.Map; -public class JitsiMeetView extends BaseReactView - implements OngoingConferenceTracker.OngoingConferenceListener { +public class JitsiMeetView extends FrameLayout { /** - * The {@code Method}s of {@code JitsiMeetViewListener} by event name i.e. - * redux action types. + * Background color used by {@code BaseReactView} and the React Native root + * view. */ - private static final Map LISTENER_METHODS - = ListenerUtils.mapListenerMethods(JitsiMeetViewListener.class); + private static final int BACKGROUND_COLOR = 0xFF111111; /** - * The URL of the current conference. + * React Native root view. */ - // XXX Currently, one thread writes and one thread reads, so it should be - // fine to have this field volatile without additional synchronization. - private volatile String url; + private ReactRootView reactRootView; /** * Helper method to recursively merge 2 {@link Bundle} objects representing React Native props. @@ -109,10 +106,19 @@ public class JitsiMeetView extends BaseReactView initialize(context); } - @Override + /** + * Releases the React resources (specifically the {@link ReactRootView}) + * associated with this view. + * + * MUST be called when the {@link Activity} holding this view is destroyed, + * typically in the {@code onDestroy} method. + */ public void dispose() { - OngoingConferenceTracker.getInstance().removeListener(this); - super.dispose(); + if (reactRootView != null) { + removeView(reactRootView); + reactRootView.unmountReactApplication(); + reactRootView = null; + } } /** @@ -130,8 +136,7 @@ public class JitsiMeetView extends BaseReactView PictureInPictureModule.class); if (pipModule != null && pipModule.isPictureInPictureSupported() - && !JitsiMeetActivityDelegate.arePermissionsBeingRequested() - && this.url != null) { + && !JitsiMeetActivityDelegate.arePermissionsBeingRequested()) { try { pipModule.enterPictureInPicture(); } catch (RuntimeException re) { @@ -151,10 +156,40 @@ public class JitsiMeetView extends BaseReactView } /** - * Leaves the currently active conference. + * Creates the {@code ReactRootView} for the given app name with the given + * props. Once created it's set as the view of this {@code FrameLayout}. + * + * @param appName - The name of the "app" (in React Native terms) to load. + * @param props - The React Component props to pass to the app. */ - public void leave() { - setProps(new Bundle()); + private void createReactRootView(String appName, @Nullable Bundle props) { + if (props == null) { + props = new Bundle(); + } + + if (reactRootView == null) { + reactRootView = new ReactRootView(getContext()); + reactRootView.startReactApplication( + ReactInstanceManagerHolder.getReactInstanceManager(), + appName, + props); + reactRootView.setBackgroundColor(BACKGROUND_COLOR); + addView(reactRootView); + } else { + reactRootView.setAppProperties(props); + } + } + + private void initialize(@NonNull Context context) { + // Check if the parent Activity implements JitsiMeetActivityInterface, + // otherwise things may go wrong. + if (!(context instanceof JitsiMeetActivityInterface)) { + throw new RuntimeException("Enclosing Activity must implement JitsiMeetActivityInterface"); + } + + setBackgroundColor(BACKGROUND_COLOR); + + ReactInstanceManagerHolder.initReactInstanceManager((Activity) context); } /** @@ -179,46 +214,27 @@ public class JitsiMeetView extends BaseReactView createReactRootView("App", props); } - /** - * Handler for {@link OngoingConferenceTracker} events. - * @param conferenceUrl - */ - @Override - public void onCurrentConferenceChanged(String conferenceUrl) { - // This property was introduced in order to address - // an exception in the Picture-in-Picture functionality which arose - // because of delays related to bridging between JavaScript and Java. To - // reduce these delays do not wait for the call to be transferred to the - // UI thread. - this.url = conferenceUrl; - } - - /** - * Handler for {@link ExternalAPIModule} events. - * - * @param name The name of the event. - * @param data The details/specifics of the event to send determined - * by/associated with the specified {@code name}. - */ - @Override - @Deprecated - protected void onExternalAPIEvent(String name, ReadableMap data) { - onExternalAPIEvent(LISTENER_METHODS, name, data); - } - @Override protected void onDetachedFromWindow() { dispose(); super.onDetachedFromWindow(); } - private void initialize(@NonNull Context context) { - // Check if the parent Activity implements JitsiMeetActivityInterface, - // otherwise things may go wrong. - if (!(context instanceof JitsiMeetActivityInterface)) { - throw new RuntimeException("Enclosing Activity must implement JitsiMeetActivityInterface"); - } + /** + * Called when the window containing this view gains or loses focus. + * + * @param hasFocus If the window of this view now has focus, {@code true}; + * otherwise, {@code false}. + */ + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); - OngoingConferenceTracker.getInstance().addListener(this); + // https://github.com/mockingbot/react-native-immersive#restore-immersive-state + RNImmersiveModule immersive = RNImmersiveModule.getInstance(); + + if (hasFocus && immersive != null) { + immersive.emitImmersiveStateChangeEvent(); + } } } diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java deleted file mode 100644 index 4d97308d3e..0000000000 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java +++ /dev/null @@ -1,51 +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 java.util.Map; - -/** - * Interface for listening to events coming from Jitsi Meet. - */ -@Deprecated -public interface JitsiMeetViewListener { - /** - * Called when a conference was joined. - * - * @param data Map with a "url" key with the conference URL. - */ - void onConferenceJoined(Map data); - - /** - * Called when the active conference ends, be it because of user choice or - * because of a failure. - * - * @param data Map with an "error" key with the error and a "url" key with - * the conference URL. If the conference finished gracefully no `error` - * key will be present. The possible values for "error" are described here: - * https://github.com/jitsi/lib-jitsi-meet/blob/master/JitsiConnectionErrors.js - * https://github.com/jitsi/lib-jitsi-meet/blob/master/JitsiConferenceErrors.js - */ - void onConferenceTerminated(Map data); - - /** - * Called before the conference is joined. - * - * @param data Map with a "url" key with the conference URL. - */ - void onConferenceWillJoin(Map data); -} diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ListenerUtils.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ListenerUtils.java deleted file mode 100644 index cb8f9781dc..0000000000 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ListenerUtils.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright @ 2018-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 com.facebook.react.bridge.ReadableMap; -import com.facebook.react.bridge.ReadableMapKeySetIterator; -import com.facebook.react.bridge.UiThreadUtil; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.regex.Pattern; - -/** - * Utility methods for helping with transforming {@link ExternalAPIModule} - * events into listener methods. Used with descendants of {@link BaseReactView}. - */ -@Deprecated -public final class ListenerUtils { - /** - * Extracts the methods defined in a listener and creates a mapping of this - * form: event name -> method. - * - * @param listener - The listener whose methods we want to slurp. - * @return A mapping with event names - methods. - */ - public static Map mapListenerMethods(Class listener) { - Map methods = new HashMap<>(); - - // Figure out the mapping between the listener methods - // and the events i.e. redux action types. - Pattern onPattern = Pattern.compile("^on[A-Z]+"); - Pattern camelcasePattern = Pattern.compile("([a-z0-9]+)([A-Z0-9]+)"); - - for (Method method : listener.getDeclaredMethods()) { - // * The method must be public (because it is declared by an - // interface). - // * The method must be/return void. - if (!Modifier.isPublic(method.getModifiers()) - || !Void.TYPE.equals(method.getReturnType())) { - continue; - } - - // * The method name must start with "on" followed by a - // capital/uppercase letter (in agreement with the camelcase - // coding style customary to Java in general and the projects of - // the Jitsi community in particular). - String name = method.getName(); - - if (!onPattern.matcher(name).find()) { - continue; - } - - // * The method must accept/have exactly 1 parameter of a type - // assignable from HashMap. - Class[] parameterTypes = method.getParameterTypes(); - - if (parameterTypes.length != 1 - || !parameterTypes[0].isAssignableFrom(HashMap.class)) { - continue; - } - - // Convert the method name to an event name. - name - = camelcasePattern.matcher(name.substring(2)) - .replaceAll("$1_$2") - .toUpperCase(Locale.ROOT); - methods.put(name, method); - } - - return methods; - } - - /** - * Executes the right listener method for the given event. - * NOTE: This function will run asynchronously on the UI thread. - * - * @param listener - The listener on which the method will be called. - * @param listenerMethods - Mapping with event names and the matching - * methods. - * @param eventName - Name of the event. - * @param eventData - Data associated with the event. - */ - public static void runListenerMethod( - final Object listener, - final Map listenerMethods, - final String eventName, - final ReadableMap eventData) { - // Make sure listener methods are invoked on the UI thread. It - // was requested by SDK consumers. - if (UiThreadUtil.isOnUiThread()) { - runListenerMethodOnUiThread( - listener, listenerMethods, eventName, eventData); - } else { - UiThreadUtil.runOnUiThread(new Runnable() { - @Override - public void run() { - runListenerMethodOnUiThread( - listener, listenerMethods, eventName, eventData); - } - }); - } - } - - /** - * Helper companion for {@link ListenerUtils#runListenerMethod} which runs - * in the UI thread. - */ - private static void runListenerMethodOnUiThread( - Object listener, - Map listenerMethods, - String eventName, - ReadableMap eventData) { - UiThreadUtil.assertOnUiThread(); - - Method method = listenerMethods.get(eventName); - if (method != null) { - try { - method.invoke(listener, toHashMap(eventData)); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } - } - } - - /** - * Initializes a new {@code HashMap} instance with the key-value - * associations of a specific {@code ReadableMap}. - * - * @param readableMap the {@code ReadableMap} specifying the key-value - * associations with which the new {@code HashMap} instance is to be - * initialized. - * @return a new {@code HashMap} instance initialized with the key-value - * associations of the specified {@code readableMap}. - */ - private static HashMap toHashMap(ReadableMap readableMap) { - HashMap hashMap = new HashMap<>(); - - for (ReadableMapKeySetIterator i = readableMap.keySetIterator(); - i.hasNextKey();) { - String key = i.nextKey(); - - hashMap.put(key, readableMap.getString(key)); - } - - return hashMap; - } -} diff --git a/ios/sdk/src/JitsiMeetRenderingView.m b/ios/sdk/src/JitsiMeetRenderingView.m index 25b7efa151..54abdce81e 100644 --- a/ios/sdk/src/JitsiMeetRenderingView.m +++ b/ios/sdk/src/JitsiMeetRenderingView.m @@ -26,14 +26,6 @@ static NSString *const PiPEnabledFeatureFlag = @"pip.enabled"; @interface JitsiMeetRenderingView () - -/** - * The unique identifier of this `JitsiMeetView` within the process for the - * purposes of `ExternalAPI`. The name scope was inspired by postis which we - * use on Web for the similar purposes of the iframe-based external API. - */ -@property (nonatomic, strong) NSString *externalAPIScope; - @end @implementation JitsiMeetRenderingView { @@ -43,16 +35,6 @@ static NSString *const PiPEnabledFeatureFlag = @"pip.enabled"; RNRootView *rootView; } -- (instancetype)init { - self = [super init]; - if (self) { - // Hook this JitsiMeetView into ExternalAPI. - self.externalAPIScope = [NSUUID UUID].UUIDString; - } - - return self; -} - /** * Passes the given props to the React Native application. The props which we pass * are a combination of 3 different sources: @@ -71,8 +53,6 @@ static NSString *const PiPEnabledFeatureFlag = @"pip.enabled"; featureFlags[PiPEnabledFeatureFlag] = @(self.isPiPEnabled); } - props[@"externalAPIScope"] = self.externalAPIScope; - // This method is supposed to be imperative i.e. a second // invocation with one and the same URL is expected to join the respective // conference again if the first invocation was followed by leaving the diff --git a/react/features/app/components/App.native.js b/react/features/app/components/App.native.js index 4e0e97e8bd..46471b3abf 100644 --- a/react/features/app/components/App.native.js +++ b/react/features/app/components/App.native.js @@ -33,11 +33,6 @@ const DialogContainerWrapper = Platform.select({ */ type Props = AbstractAppProps & { - /** - * Identifier for this app on the native side. - */ - externalAPIScope: string, - /** * An object with the feature flags. */ diff --git a/react/features/mobile/external-api/functions.js b/react/features/mobile/external-api/functions.js index 0c55ace991..a7a3952b5c 100644 --- a/react/features/mobile/external-api/functions.js +++ b/react/features/mobile/external-api/functions.js @@ -3,7 +3,6 @@ import debounce from 'lodash/debounce'; import { NativeModules } from 'react-native'; -import { getAppProp } from '../../base/app'; import { readyToClose } from '../external-api/actions'; @@ -19,13 +18,7 @@ import { readyToClose } from '../external-api/actions'; * @returns {void} */ export function sendEvent(store: Object, name: string, data: Object) { - // The JavaScript App needs to provide uniquely identifying information to - // the native ExternalAPI module so that the latter may match the former to - // the native view which hosts it. - const externalAPIScope = getAppProp(store, 'externalAPIScope'); - - externalAPIScope - && NativeModules.ExternalAPI.sendEvent(name, data, externalAPIScope); + NativeModules.ExternalAPI.sendEvent(name, data); } /**