浏览代码

Fixes hangup triggering several times

master
yanas 8 年前
父节点
当前提交
2bb637e140
共有 3 个文件被更改,包括 50 次插入21 次删除
  1. 15
    0
      conference.js
  2. 11
    0
      modules/UI/Feedback.js
  3. 24
    21
      modules/UI/UI.js

+ 15
- 0
conference.js 查看文件

@@ -37,6 +37,12 @@ let connectionIsInterrupted = false;
37 37
  */
38 38
 let DSExternalInstallationInProgress = false;
39 39
 
40
+/**
41
+ * Indicates whether we have started a hangup process.
42
+ * @type {boolean}
43
+ */
44
+let _hangupInProgress = false;
45
+
40 46
 import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
41 47
 
42 48
 /**
@@ -232,6 +238,13 @@ function disconnectAndShowFeedback(requestFeedback) {
232 238
  * @param {boolean} [requestFeedback=false] if user feedback should be requested
233 239
  */
234 240
 function hangup (requestFeedback = false) {
241
+    if (_hangupInProgress) {
242
+        console.log("Hangup already in progress.");
243
+        return;
244
+    }
245
+
246
+    _hangupInProgress = true;
247
+
235 248
     const errCallback = (f, err) => {
236 249
         console.error('Error occurred during hanging up: ', err);
237 250
         return f();
@@ -242,6 +255,8 @@ function hangup (requestFeedback = false) {
242 255
     .catch(errCallback.bind(null, disconnect))
243 256
     .then(maybeRedirectToWelcomePage)
244 257
     .catch(errCallback.bind(null, maybeRedirectToWelcomePage));
258
+
259
+    _hangupInProgress = false;
245 260
 }
246 261
 
247 262
 /**

+ 11
- 0
modules/UI/Feedback.js 查看文件

@@ -134,6 +134,17 @@ var Feedback = {
134 134
     isEnabled: function() {
135 135
         return this.enabled && APP.conference.isCallstatsEnabled();
136 136
     },
137
+
138
+    /**
139
+     * Returns true if the feedback window is currently visible and false
140
+     * otherwise.
141
+     * @return {boolean} true if the feedback window is visible, false
142
+     * otherwise
143
+     */
144
+    isVisible: function() {
145
+        return $(".feedback").is(":visible");
146
+    },
147
+
137 148
     /**
138 149
      * Opens the feedback window.
139 150
      */

+ 24
- 21
modules/UI/UI.js 查看文件

@@ -1063,29 +1063,32 @@ UI.inviteParticipants = function (roomUrl, conferenceName, key, nick) {
1063 1063
  * @returns {Promise} when dialog is closed.
1064 1064
  */
1065 1065
 UI.requestFeedback = function () {
1066
-    return new Promise(function (resolve, reject) {
1067
-        if (Feedback.isEnabled()) {
1068
-            // If the user has already entered feedback, we'll show the window and
1069
-            // immidiately start the conference dispose timeout.
1070
-            if (Feedback.feedbackScore > 0) {
1071
-                Feedback.openFeedbackWindow();
1066
+    if (Feedback.isVisible())
1067
+        return Promise.resolve();
1068
+    else
1069
+        return new Promise(function (resolve, reject) {
1070
+            if (Feedback.isEnabled()) {
1071
+                // If the user has already entered feedback, we'll show the
1072
+                // window and immidiately start the conference dispose timeout.
1073
+                if (Feedback.feedbackScore > 0) {
1074
+                    Feedback.openFeedbackWindow();
1075
+                    resolve();
1076
+
1077
+                } else { // Otherwise we'll wait for user's feedback.
1078
+                    Feedback.openFeedbackWindow(resolve);
1079
+                }
1080
+            } else {
1081
+                // If the feedback functionality isn't enabled we show a thank
1082
+                // you dialog.
1083
+                messageHandler.openMessageDialog(
1084
+                    null, null, null,
1085
+                    APP.translation.translateString(
1086
+                        "dialog.thankYou", {appName:interfaceConfig.APP_NAME}
1087
+                    )
1088
+                );
1072 1089
                 resolve();
1073
-
1074
-            } else { // Otherwise we'll wait for user's feedback.
1075
-                Feedback.openFeedbackWindow(resolve);
1076 1090
             }
1077
-        } else {
1078
-            // If the feedback functionality isn't enabled we show a thank you
1079
-            // dialog.
1080
-            messageHandler.openMessageDialog(
1081
-                null, null, null,
1082
-                APP.translation.translateString(
1083
-                    "dialog.thankYou", {appName:interfaceConfig.APP_NAME}
1084
-                )
1085
-            );
1086
-            resolve();
1087
-        }
1088
-    });
1091
+        });
1089 1092
 };
1090 1093
 
1091 1094
 UI.updateRecordingState = function (state) {

正在加载...
取消
保存