|
|
@@ -38,13 +38,6 @@ let connectionIsInterrupted = false;
|
|
38
|
38
|
*/
|
|
39
|
39
|
let DSExternalInstallationInProgress = false;
|
|
40
|
40
|
|
|
41
|
|
-/**
|
|
42
|
|
- * Listens whether conference had been left from local user when we are trying
|
|
43
|
|
- * to navigate away from current page.
|
|
44
|
|
- * @type {HangupConferenceLeftListener}
|
|
45
|
|
- */
|
|
46
|
|
-let conferenceLeftListener = null;
|
|
47
|
|
-
|
|
48
|
41
|
import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/VideoContainer";
|
|
49
|
42
|
|
|
50
|
43
|
/**
|
|
|
@@ -219,50 +212,6 @@ function maybeRedirectToWelcomePage(showThankYou) {
|
|
219
|
212
|
}, 3000);
|
|
220
|
213
|
}
|
|
221
|
214
|
|
|
222
|
|
-
|
|
223
|
|
-/**
|
|
224
|
|
- * Listens for CONFERENCE_LEFT event after hangup function has been executed.
|
|
225
|
|
- */
|
|
226
|
|
-class HangupConferenceLeftListener {
|
|
227
|
|
- /**
|
|
228
|
|
- * Creates HangupConferenceLeftListener and start listening for conference
|
|
229
|
|
- * left event. On CONFERENCE_LEFT event calls should disconnect the user
|
|
230
|
|
- * and maybe show the feedback dialog.
|
|
231
|
|
- * @param {boolean} [requestFeedback=false] if user feedback should be
|
|
232
|
|
- * requested
|
|
233
|
|
- */
|
|
234
|
|
- constructor(requestFeedback) {
|
|
235
|
|
- this.requestFeedback = requestFeedback;
|
|
236
|
|
- room.on(ConferenceEvents.CONFERENCE_LEFT,
|
|
237
|
|
- this._handleConferenceLeft.bind(this));
|
|
238
|
|
- }
|
|
239
|
|
-
|
|
240
|
|
- /**
|
|
241
|
|
- * Handles the conference left event.
|
|
242
|
|
- * @private
|
|
243
|
|
- */
|
|
244
|
|
- _handleConferenceLeft() {
|
|
245
|
|
- this._disconnectAndShowFeedback()
|
|
246
|
|
- .then(() => {
|
|
247
|
|
- APP.API.notifyReadyToClose();
|
|
248
|
|
- maybeRedirectToWelcomePage();
|
|
249
|
|
- }).catch(console.log);
|
|
250
|
|
- }
|
|
251
|
|
-
|
|
252
|
|
- /**
|
|
253
|
|
- * Executes connection.disconnect and shows the feedback dialog
|
|
254
|
|
- * @returns Promise.
|
|
255
|
|
- * @private
|
|
256
|
|
- */
|
|
257
|
|
- _disconnectAndShowFeedback() {
|
|
258
|
|
- APP.UI.hideRingOverLay();
|
|
259
|
|
- connection.disconnect();
|
|
260
|
|
- APP.API.notifyConferenceLeft(APP.conference.roomName);
|
|
261
|
|
- return (this.requestFeedback) ?
|
|
262
|
|
- APP.UI.requestFeedback() : Promise.resolve();
|
|
263
|
|
- }
|
|
264
|
|
-}
|
|
265
|
|
-
|
|
266
|
215
|
/**
|
|
267
|
216
|
* Create local tracks of specified types.
|
|
268
|
217
|
* @param {Object} options
|
|
|
@@ -486,6 +435,17 @@ function sendTokenDataStats() {
|
|
486
|
435
|
}
|
|
487
|
436
|
}
|
|
488
|
437
|
|
|
|
438
|
+/**
|
|
|
439
|
+ * Disconnects the connection.
|
|
|
440
|
+ * @returns resolved Promise. We need this in order to make the Promise.all
|
|
|
441
|
+ * call in hangup() to resolve when all operations are finished.
|
|
|
442
|
+ */
|
|
|
443
|
+function disconnect() {
|
|
|
444
|
+ connection.disconnect();
|
|
|
445
|
+ APP.API.notifyConferenceLeft(APP.conference.roomName);
|
|
|
446
|
+ return Promise.resolve();
|
|
|
447
|
+}
|
|
|
448
|
+
|
|
489
|
449
|
/**
|
|
490
|
450
|
* Set permanent ptoperties to analytics.
|
|
491
|
451
|
* NOTE: Has to be used after JitsiMeetJS.init. otherwise analytics will be
|
|
|
@@ -1784,13 +1744,20 @@ export default {
|
|
1784
|
1744
|
* requested
|
|
1785
|
1745
|
*/
|
|
1786
|
1746
|
hangup (requestFeedback = false) {
|
|
1787
|
|
- if (!conferenceLeftListener) {
|
|
1788
|
|
- conferenceLeftListener
|
|
1789
|
|
- = new HangupConferenceLeftListener(requestFeedback);
|
|
1790
|
|
- }
|
|
1791
|
|
-
|
|
1792
|
|
- //FIXME: Do something for the use case when we are not receiving
|
|
1793
|
|
- // CONFERENCE_LEFT for some reason
|
|
1794
|
|
- room.leave();
|
|
|
1747
|
+ APP.UI.hideRingOverLay();
|
|
|
1748
|
+ let requestFeedbackPromise = requestFeedback
|
|
|
1749
|
+ ? APP.UI.requestFeedback().catch(() => Promise.resolve())
|
|
|
1750
|
+ : Promise.resolve();
|
|
|
1751
|
+ // All promises are returning Promise.resolve to make Promise.all to
|
|
|
1752
|
+ // be resolved when both Promises are finished. Otherwise Promise.all
|
|
|
1753
|
+ // will reject on first rejected Promise and we can redirect the page
|
|
|
1754
|
+ // before all operations are done.
|
|
|
1755
|
+ Promise.all([
|
|
|
1756
|
+ requestFeedbackPromise,
|
|
|
1757
|
+ room.leave().then(disconnect, disconnect)
|
|
|
1758
|
+ ]).then(() => {
|
|
|
1759
|
+ APP.API.notifyReadyToClose();
|
|
|
1760
|
+ maybeRedirectToWelcomePage();
|
|
|
1761
|
+ });
|
|
1795
|
1762
|
}
|
|
1796
|
1763
|
};
|