瀏覽代碼

fix(JitsiMeetView): use setAppProperties

j8
paweldomas 7 年之前
父節點
當前提交
3f6f5e7eb9
共有 1 個檔案被更改,包括 20 行新增8 行删除
  1. 20
    8
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java

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

@@ -370,14 +370,26 @@ public class JitsiMeetView extends FrameLayout {
370 370
         // welcomePageEnabled
371 371
         props.putBoolean("welcomePageEnabled", welcomePageEnabled);
372 372
 
373
-        // TODO: ReactRootView#setAppProperties is only available on React
374
-        // Native 0.45, so destroy the current root view and create a new one.
375
-        dispose();
376
-
377
-        reactRootView = new ReactRootView(getContext());
378
-        reactRootView.startReactApplication(reactInstanceManager, "App", props);
379
-        reactRootView.setBackgroundColor(BACKGROUND_COLOR);
380
-        addView(reactRootView);
373
+        // XXX The method loadURLObject: is supposed to be imperative i.e.
374
+        // a second invocation with one and the same URL is expected to join
375
+        // the respective conference again if the first invocation was followed
376
+        // by leaving the conference. However, React and, respectively,
377
+        // appProperties/initialProperties are declarative expressions i.e. one
378
+        // and the same URL will not trigger componentWillReceiveProps in the
379
+        // JavaScript source code. The workaround implemented bellow introduces
380
+        // imperativeness in React Component props by defining a unique value
381
+        // per loadURLObject: invocation.
382
+        props.putLong("timestamp", System.currentTimeMillis());
383
+
384
+        if (reactRootView == null) {
385
+            reactRootView = new ReactRootView(getContext());
386
+            reactRootView.startReactApplication(
387
+                reactInstanceManager, "App", props);
388
+            reactRootView.setBackgroundColor(BACKGROUND_COLOR);
389
+            addView(reactRootView);
390
+        } else {
391
+            reactRootView.setAppProperties(props);
392
+        }
381 393
     }
382 394
 
383 395
     /**

Loading…
取消
儲存