|
|
|
@ -21,9 +21,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule; |
|
|
|
|
import com.facebook.react.bridge.ReactMethod; |
|
|
|
|
import com.facebook.react.bridge.ReadableMap; |
|
|
|
|
import com.facebook.react.bridge.ReadableMapKeySetIterator; |
|
|
|
|
|
|
|
|
|
import org.jitsi.meet.sdk.JitsiMeetView; |
|
|
|
|
import org.jitsi.meet.sdk.JitsiMeetViewListener; |
|
|
|
|
import com.facebook.react.bridge.UiThreadUtil; |
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
|
import java.lang.reflect.Method; |
|
|
|
@ -150,11 +148,18 @@ class ExternalAPIModule extends ReactContextBaseJavaModule { |
|
|
|
|
* @param scope |
|
|
|
|
*/ |
|
|
|
|
@ReactMethod |
|
|
|
|
public void sendEvent(String name, ReadableMap data, String scope) { |
|
|
|
|
// 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 JitsiMeetView which hosts it.
|
|
|
|
|
JitsiMeetView view = JitsiMeetView.findViewByExternalAPIScope(scope); |
|
|
|
|
public void sendEvent(final String name, |
|
|
|
|
final ReadableMap data, |
|
|
|
|
final String scope) { |
|
|
|
|
UiThreadUtil.runOnUiThread(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
// 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 JitsiMeetView which
|
|
|
|
|
// hosts it.
|
|
|
|
|
JitsiMeetView view |
|
|
|
|
= JitsiMeetView.findViewByExternalAPIScope(scope); |
|
|
|
|
|
|
|
|
|
if (view == null) { |
|
|
|
|
return; |
|
|
|
@ -174,13 +179,14 @@ class ExternalAPIModule extends ReactContextBaseJavaModule { |
|
|
|
|
try { |
|
|
|
|
method.invoke(listener, toHashMap(data)); |
|
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
|
// FIXME There was a multicatch for IllegalAccessException and
|
|
|
|
|
// InvocationTargetException, but Android Studio complained
|
|
|
|
|
// with:
|
|
|
|
|
// "Multi-catch with these reflection exceptions requires
|
|
|
|
|
// API level 19 (current min is 16) because they get compiled to
|
|
|
|
|
// the common but new super type ReflectiveOperationException.
|
|
|
|
|
// As a workaround either create individual catch statements, or
|
|
|
|
|
// FIXME There was a multicatch for
|
|
|
|
|
// IllegalAccessException and InvocationTargetException,
|
|
|
|
|
// but Android Studio complained with: "Multi-catch with
|
|
|
|
|
// these reflection exceptions requires API level 19
|
|
|
|
|
// (current min is 16) because they get compiled to the
|
|
|
|
|
// common but new super type
|
|
|
|
|
// ReflectiveOperationException. As a workaround either
|
|
|
|
|
// create individual catch statements, or
|
|
|
|
|
// catch Exception."
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
@ -188,6 +194,8 @@ class ExternalAPIModule extends ReactContextBaseJavaModule { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Initializes a new {@code HashMap} instance with the key-value |
|
|
|
|