瀏覽代碼

fix(android) avoid exception in onHostPause

YOLO.
master
Saúl Ibarra Corretgé 3 年之前
父節點
當前提交
7d6365c5e0
共有 1 個檔案被更改,包括 8 行新增5 行删除
  1. 8
    5
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivityDelegate.java

+ 8
- 5
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivityDelegate.java 查看文件

@@ -116,12 +116,15 @@ public class JitsiMeetActivityDelegate {
116 116
             = ReactInstanceManagerHolder.getReactInstanceManager();
117 117
 
118 118
         if (reactInstanceManager != null) {
119
-            // Try to avoid a crash because some devices trip on this assert:
120
-            // https://github.com/facebook/react-native/blob/df4e67fe75d781d1eb264128cadf079989542755/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java#L512
121
-            // Why this happens is a mystery wrapped in an enigma.
122
-            ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
123
-            if (reactContext != null && activity == reactContext.getCurrentActivity()) {
119
+            try {
124 120
                 reactInstanceManager.onHostPause(activity);
121
+            } catch (AssertionError e) {
122
+                // There seems to be a problem in RN when resuming an Activity when
123
+                // rotation is involved and the planets align. There doesn't seem to
124
+                // be a proper solution, but since the activity is going away anyway,
125
+                // we'll YOLO-ignore the exception and hope fo the best.
126
+                // Ref: https://github.com/facebook/react-native/search?q=Pausing+an+activity+that+is+not+the+current+activity%2C+this+is+incorrect%21&type=issues
127
+                JitsiMeetLogger.e(e, "Error running onHostPause, ignoring");
125 128
             }
126 129
         }
127 130
     }

Loading…
取消
儲存