瀏覽代碼

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
  */
37
  */
38
 let DSExternalInstallationInProgress = false;
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
 import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
46
 import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
41
 
47
 
42
 /**
48
 /**
232
  * @param {boolean} [requestFeedback=false] if user feedback should be requested
238
  * @param {boolean} [requestFeedback=false] if user feedback should be requested
233
  */
239
  */
234
 function hangup (requestFeedback = false) {
240
 function hangup (requestFeedback = false) {
241
+    if (_hangupInProgress) {
242
+        console.log("Hangup already in progress.");
243
+        return;
244
+    }
245
+
246
+    _hangupInProgress = true;
247
+
235
     const errCallback = (f, err) => {
248
     const errCallback = (f, err) => {
236
         console.error('Error occurred during hanging up: ', err);
249
         console.error('Error occurred during hanging up: ', err);
237
         return f();
250
         return f();
242
     .catch(errCallback.bind(null, disconnect))
255
     .catch(errCallback.bind(null, disconnect))
243
     .then(maybeRedirectToWelcomePage)
256
     .then(maybeRedirectToWelcomePage)
244
     .catch(errCallback.bind(null, maybeRedirectToWelcomePage));
257
     .catch(errCallback.bind(null, maybeRedirectToWelcomePage));
258
+
259
+    _hangupInProgress = false;
245
 }
260
 }
246
 
261
 
247
 /**
262
 /**

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

134
     isEnabled: function() {
134
     isEnabled: function() {
135
         return this.enabled && APP.conference.isCallstatsEnabled();
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
      * Opens the feedback window.
149
      * Opens the feedback window.
139
      */
150
      */

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

1063
  * @returns {Promise} when dialog is closed.
1063
  * @returns {Promise} when dialog is closed.
1064
  */
1064
  */
1065
 UI.requestFeedback = function () {
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
                 resolve();
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
 UI.updateRecordingState = function (state) {
1094
 UI.updateRecordingState = function (state) {

Loading…
取消
儲存