Skip to content

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

[RN] Fix opening the same URL multiple times

Lyubo Marinov6003b560ae1a
diff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.m
index 2b3afebe97..0e0985da8f 100644
--- a/ios/sdk/src/JitsiMeetView.m
+++ b/ios/sdk/src/JitsiMeetView.m
@@ -15,6 +15,7 @@
*/
#import <CoreText/CoreText.h>
+#include <mach/mach_time.h>
#import <React/RCTAssert.h>
#import <React/RCTLinkingManager.h>
@@ -239,6 +240,17 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
props[@"url"] = urlObject;
}
+ // 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[@"timestamp"] = @(mach_absolute_time());
+
if (rootView) {
// Update props with the new URL.
rootView.appProperties = props;
diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js
index 41a56c09ef..222392a035 100644
--- a/react/features/app/components/AbstractApp.js
+++ b/react/features/app/components/AbstractApp.js
@@ -47,6 +47,10 @@ export class AbstractApp extends Component {
*/
store: PropTypes.object,
+ // XXX Refer to the implementation of loadURLObject: in
+ // ios/sdk/src/JitsiMeetView.m for further information.
+ timestamp: PropTypes.any,
+
/**
* The URL, if any, with which the app was launched.
*/
@@ -143,7 +147,11 @@ export class AbstractApp extends Component {
let { url } = nextProps;
url = toURLString(url);
- if (toURLString(this.props.url) !== url) {
+ if (toURLString(this.props.url) !== url
+
+ // XXX Refer to the implementation of loadURLObject: in
+ // ios/sdk/src/JitsiMeetView.m for further information.
+ || this.props.timestamp !== nextProps.timestamp) {
this._openURL(url || this._getDefaultURL());
}
}