aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/features/conference/components/Conference.js35
-rw-r--r--app/features/recent-list/reducer.js24
2 files changed, 54 insertions, 5 deletions
diff --git a/app/features/conference/components/Conference.js b/app/features/conference/components/Conference.js
index f10a7c2..df60e46 100644
--- a/app/features/conference/components/Conference.js
+++ b/app/features/conference/components/Conference.js
@@ -74,6 +74,11 @@ class Conference extends Component<Props, State> {
_conference: Object;
/**
+ * Whether the iframe was loaded or not.
+ */
+ _iframeLoaded: boolean;
+
+ /**
* Timer to cancel the joining if it takes too long.
*/
_loadTimer: ?TimeoutID;
@@ -159,6 +164,7 @@ class Conference extends Component<Props, State> {
if (prevProps.location.key !== this.props.location.key) {
// Simulate a re-mount so the new meeting is joined.
+ this._iframeLoaded = false;
this.componentWillUnmount();
this.componentDidMount();
}
@@ -235,7 +241,6 @@ class Conference extends Component<Props, State> {
...urlParameters
});
-
this._api.on('suspendDetected', this._onVideoConferenceEnded);
this._api.on('readyToClose', this._onVideoConferenceEnded);
this._api.on('videoConferenceJoined',
@@ -304,11 +309,39 @@ class Conference extends Component<Props, State> {
* @returns {void}
*/
_onIframeLoad() {
+ if (this._iframeLoaded) {
+ // Skip spurious event after meeting close.
+ return;
+ }
+
+ console.log('IFrame loaded');
+
+ this._iframeLoaded = true;
+
if (this._loadTimer) {
clearTimeout(this._loadTimer);
this._loadTimer = null;
}
+ const frame = this._api.getIFrame();
+ const mainApp = frame.contentWindow.document.getElementById('react');
+
+ if (!mainApp) {
+ console.warn('Main application not loaded');
+
+ this._navigateToHome(
+
+ // $FlowFixMe
+ {
+ error: 'Loading error',
+ type: 'error'
+ },
+ this._conference.room,
+ this._conference.serverURL);
+
+ return;
+ }
+
this.setState({
isLoading: false
});
diff --git a/app/features/recent-list/reducer.js b/app/features/recent-list/reducer.js
index 17e86db..c78b9b2 100644
--- a/app/features/recent-list/reducer.js
+++ b/app/features/recent-list/reducer.js
@@ -47,6 +47,19 @@ export default (state: State = DEFAULT_STATE, action: Object) => {
};
/**
+ * Cleans a room name of all parameters.
+ *
+ * @param {string} roomName - The room name to be cleaned.
+ * @returns {string} - The cleaned up room name.
+ */
+function _cleanRoomName(roomName: string) {
+ const [ noQuery ] = roomName.split('?', 2);
+ const [ noParams ] = noQuery.split('#', 2);
+
+ return noParams;
+}
+
+/**
* Insert Conference details in the recent list array.
*
* @param {Array<RecentListItem>} recentList - Previous recent list array.
@@ -61,9 +74,11 @@ function _insertConference(
// Add start time to conference.
newConference.startTime = Date.now();
+ newConference.room = _cleanRoomName(newConference.room);
+
// Remove same conference.
const newRecentList: Array<RecentListItem> = recentList.filter(
- (conference: RecentListItem) => conference.room !== newConference.room
+ (conference: RecentListItem) => _cleanRoomName(conference.room) !== newConference.room
|| conference.serverURL !== newConference.serverURL);
// Add the conference at the beginning.
@@ -99,11 +114,12 @@ function _updateEndtimeOfConference(
recentList: Array<RecentListItem>,
conference: RecentListItem
) {
- for (const item of recentList) {
- if (item.room === conference.room
+ for (const item of recentList.slice()) {
+ item.room = _cleanRoomName(item.room);
+
+ if (item.room === _cleanRoomName(conference.room)
&& item.serverURL === conference.serverURL) {
item.endTime = Date.now();
- break;
}
}