Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(JitsiMeetView): use setAppProperties

paweldomas3f6f5e7eb9fb
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
index 3c2188cd2e..52e9ad1c8b 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
@@ -370,14 +370,26 @@ public class JitsiMeetView extends FrameLayout {
// welcomePageEnabled
props.putBoolean("welcomePageEnabled", welcomePageEnabled);
- // TODO: ReactRootView#setAppProperties is only available on React
- // Native 0.45, so destroy the current root view and create a new one.
- dispose();
-
- reactRootView = new ReactRootView(getContext());
- reactRootView.startReactApplication(reactInstanceManager, "App", props);
- reactRootView.setBackgroundColor(BACKGROUND_COLOR);
- addView(reactRootView);
+ // XXX The method loadURLObject: is supposed to be imperative i.e.
+ // a second invocation with one and the same URL is expected to join
+ // the respective conference again if the first invocation was followed
+ // by leaving the conference. However, React and, respectively,
+ // appProperties/initialProperties are declarative expressions i.e. one
+ // and the same URL will not trigger componentWillReceiveProps in the
+ // JavaScript source code. The workaround implemented bellow introduces
+ // imperativeness in React Component props by defining a unique value
+ // per loadURLObject: invocation.
+ props.putLong("timestamp", System.currentTimeMillis());
+
+ if (reactRootView == null) {
+ reactRootView = new ReactRootView(getContext());
+ reactRootView.startReactApplication(
+ reactInstanceManager, "App", props);
+ reactRootView.setBackgroundColor(BACKGROUND_COLOR);
+ addView(reactRootView);
+ } else {
+ reactRootView.setAppProperties(props);
+ }
}
/**