Просмотр исходного кода

fix(JitsiMeetView): use setAppProperties

j8
paweldomas 7 лет назад
Родитель
Сommit
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
         // welcomePageEnabled
370
         // welcomePageEnabled
371
         props.putBoolean("welcomePageEnabled", welcomePageEnabled);
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
     /**

Загрузка…
Отмена
Сохранить