|
@@ -25,6 +25,7 @@ import android.os.Build;
|
25
|
25
|
import android.os.Bundle;
|
26
|
26
|
import android.support.annotation.NonNull;
|
27
|
27
|
import android.support.annotation.Nullable;
|
|
28
|
+import android.util.Log;
|
28
|
29
|
import android.widget.FrameLayout;
|
29
|
30
|
|
30
|
31
|
import com.facebook.react.ReactInstanceManager;
|
|
@@ -53,6 +54,12 @@ public class JitsiMeetView extends FrameLayout {
|
53
|
54
|
*/
|
54
|
55
|
private static final int BACKGROUND_COLOR = 0xFF111111;
|
55
|
56
|
|
|
57
|
+ /**
|
|
58
|
+ * The {@link Log} tag which identifies the source of the log messages of
|
|
59
|
+ * {@code JitsiMeetView}.
|
|
60
|
+ */
|
|
61
|
+ private final static String TAG = JitsiMeetView.class.getSimpleName();
|
|
62
|
+
|
56
|
63
|
/**
|
57
|
64
|
* React Native bridge. The instance manager allows embedding applications
|
58
|
65
|
* to create multiple root views off the same JavaScript bundle.
|
|
@@ -266,13 +273,15 @@ public class JitsiMeetView extends FrameLayout {
|
266
|
273
|
* @param params {@code WritableMap} optional ancillary data for the event.
|
267
|
274
|
*/
|
268
|
275
|
private static void sendEvent(
|
269
|
|
- String eventName, @Nullable WritableMap params) {
|
|
276
|
+ String eventName,
|
|
277
|
+ @Nullable WritableMap params) {
|
270
|
278
|
if (reactInstanceManager != null) {
|
271
|
279
|
ReactContext reactContext
|
272
|
280
|
= reactInstanceManager.getCurrentReactContext();
|
273
|
281
|
if (reactContext != null) {
|
274
|
282
|
reactContext
|
275
|
|
- .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
283
|
+ .getJSModule(
|
|
284
|
+ DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
276
|
285
|
.emit(eventName, params);
|
277
|
286
|
}
|
278
|
287
|
}
|
|
@@ -498,10 +507,29 @@ public class JitsiMeetView extends FrameLayout {
|
498
|
507
|
super.onWindowFocusChanged(hasFocus);
|
499
|
508
|
|
500
|
509
|
// https://github.com/mockingbot/react-native-immersive#restore-immersive-state
|
|
510
|
+
|
|
511
|
+ // FIXME The singleton pattern employed by RNImmersiveModule is not
|
|
512
|
+ // advisable because a react-native mobule is consumable only after its
|
|
513
|
+ // BaseJavaModule#initialize() has completed and here we have no
|
|
514
|
+ // knowledge of whether the precondition is really met.
|
501
|
515
|
RNImmersiveModule immersive = RNImmersiveModule.getInstance();
|
502
|
516
|
|
503
|
517
|
if (hasFocus && immersive != null) {
|
504
|
|
- immersive.emitImmersiveStateChangeEvent();
|
|
518
|
+ try {
|
|
519
|
+ immersive.emitImmersiveStateChangeEvent();
|
|
520
|
+ } catch (RuntimeException re) {
|
|
521
|
+ // FIXME I don't know how to check myself whether
|
|
522
|
+ // BaseJavaModule#initialize() has been invoked and thus
|
|
523
|
+ // RNImmersiveModule is consumable. A safe workaround is to
|
|
524
|
+ // swallow the failure because the whole full-screen/immersive
|
|
525
|
+ // functionality is brittle anyway, akin to the icing on the
|
|
526
|
+ // cake, and has been working without onWindowFocusChanged for a
|
|
527
|
+ // very long time.
|
|
528
|
+ Log.e(
|
|
529
|
+ TAG,
|
|
530
|
+ "RNImmersiveModule#emitImmersiveStateChangeEvent() failed!",
|
|
531
|
+ re);
|
|
532
|
+ }
|
505
|
533
|
}
|
506
|
534
|
}
|
507
|
535
|
|