Ver código fonte

Fixes some issues pointed out from hristoterezov

j8
yanas 8 anos atrás
pai
commit
642fa8d6f8

+ 1
- 1
modules/UI/UI.js Ver arquivo

@@ -17,7 +17,7 @@ import Recording from "./recording/Recording";
17 17
 import GumPermissionsOverlay
18 18
     from './gum_overlay/UserMediaPermissionsGuidanceOverlay';
19 19
 
20
-import PageReloadOverlay from './reload_overlay/PageReloadOverlay';
20
+import * as PageReloadOverlay from './reload_overlay/PageReloadOverlay';
21 21
 import SuspendedOverlay from './suspended_overlay/SuspendedOverlay';
22 22
 import VideoLayout from "./videolayout/VideoLayout";
23 23
 import FilmStrip from "./videolayout/FilmStrip";

+ 14
- 9
modules/UI/overlay/Overlay.js Ver arquivo

@@ -15,13 +15,20 @@ export default class Overlay{
15 15
          * @type {jQuery}
16 16
          */
17 17
         this.$overlay = null;
18
+
19
+        /**
20
+         * Indicates if this overlay should use the light look & feel or the
21
+         * standard one.
22
+         * @type {boolean}
23
+         */
24
+        this.isLightOverlay = false;
18 25
     }
19 26
     /**
20 27
      * Template method which should be used by subclasses to provide the overlay
21 28
      * content. The contents provided by this method are later subject to
22 29
      * the translation using {@link APP.translation.translateElement}.
23 30
      * @return {string} HTML representation of the overlay dialog contents.
24
-     * @private
31
+     * @protected
25 32
      */
26 33
     _buildOverlayContent() {
27 34
         return '';
@@ -31,8 +38,9 @@ export default class Overlay{
31 38
      *
32 39
      * @param isLightOverlay indicates that this will be a light overlay look
33 40
      * and feel.
41
+     * @private
34 42
      */
35
-    buildOverlayHtml(isLightOverlay) {
43
+    _buildOverlayHtml(isLightOverlay) {
36 44
 
37 45
         let overlayContent = this._buildOverlayContent();
38 46
 
@@ -59,21 +67,18 @@ export default class Overlay{
59 67
     /**
60 68
      * Template method called just after the overlay is displayed for the first
61 69
      * time.
62
-     * @private
70
+     * @protected
63 71
      */
64 72
     _onShow() {
65 73
         // To be overridden by subclasses.
66 74
     }
67 75
     /**
68
-     * Shows the overlay dialog adn attaches the underlying HTML representation
76
+     * Shows the overlay dialog and attaches the underlying HTML representation
69 77
      * to the DOM.
70
-     *
71
-     * @param isLightOverlay indicates that this will be a light overlay look
72
-     * and feel.
73 78
      */
74
-    show(isLightOverlay) {
79
+    show() {
75 80
 
76
-        !this.$overlay && this.buildOverlayHtml(isLightOverlay);
81
+        !this.$overlay && this._buildOverlayHtml(this.isLightOverlay);
77 82
 
78 83
         if (!this.isVisible()) {
79 84
             this.$overlay.appendTo('body');

+ 76
- 70
modules/UI/reload_overlay/PageReloadOverlay.js Ver arquivo

@@ -1,7 +1,7 @@
1 1
 /* global $, APP, AJS */
2 2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
3 3
 
4
-import Overlay from '../overlay/Overlay';
4
+import Overlay from "../overlay/Overlay";
5 5
 
6 6
 /**
7 7
  * An overlay dialog which is shown before the conference is reloaded. Shows
@@ -12,13 +12,14 @@ class PageReloadOverlayImpl extends Overlay{
12 12
      * Creates new <tt>PageReloadOverlayImpl</tt>
13 13
      * @param {number} timeoutSeconds how long the overlay dialog will be
14 14
      * displayed, before the conference will be reloaded.
15
-     * @param {boolean} isDisconnect indicates if this reload screen is created
16
-     * to indicate a disconnect
17
-     * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's
18
-     * caused by network related failure or <tt>false</tt> when it's
19
-     * the infrastructure.
15
+     * @param {string} title the title of the overlay message
16
+     * @param {string} message the message of the overlay
17
+     * @param {string} buttonHtml the button html or an empty string if there's
18
+     * no button
19
+     * @param {boolean} isLightOverlay indicates if the overlay should be a
20
+     * light overlay or a standard one
20 21
      */
21
-    constructor(timeoutSeconds, isNetworkFailure) {
22
+    constructor(timeoutSeconds, title, message, buttonHtml, isLightOverlay) {
22 23
         super();
23 24
         /**
24 25
          * Conference reload counter in seconds.
@@ -31,12 +32,10 @@ class PageReloadOverlayImpl extends Overlay{
31 32
          */
32 33
         this.timeout = timeoutSeconds;
33 34
 
34
-        /**
35
-         * Indicates that a network related failure is the reason for the
36
-         * reload.
37
-         * @type {boolean}
38
-         */
39
-        this.isNetworkFailure = isNetworkFailure;
35
+        this.title = title;
36
+        this.message = message;
37
+        this.buttonHtml = buttonHtml;
38
+        this.isLightOverlay = isLightOverlay;
40 39
     }
41 40
     /**
42 41
      * Constructs overlay body with the warning message and count down towards
@@ -44,27 +43,10 @@ class PageReloadOverlayImpl extends Overlay{
44 43
      * @override
45 44
      */
46 45
     _buildOverlayContent() {
47
-        let title = (this.isNetworkFailure)
48
-                        ? "dialog.conferenceDisconnectTitle"
49
-                        : "dialog.conferenceReloadTitle";
50
-        let message = (this.isNetworkFailure)
51
-                        ? "dialog.conferenceDisconnectMsg"
52
-                        : "dialog.conferenceReloadMsg";
53
-
54
-        let button = (this.isNetworkFailure)
55
-                    ? `<button id="reconnectNow" data-i18n="dialog.reconnectNow"
56
-                    class="button-control button-control_primary
57
-                            button-control_center"></button>`
58
-                    : "";
59
-
60
-        $(document).on('click', '#reconnectNow', () => {
61
-            APP.ConferenceUrl.reload();
62
-        });
63
-
64 46
         return `<div class="inlay">
65
-                    <span data-i18n=${title}
47
+                    <span data-i18n=${this.title}
66 48
                           class='reload_overlay_title'></span>
67
-                    <span data-i18n=${message}
49
+                    <span data-i18n=${this.message}
68 50
                           class='reload_overlay_msg'></span>
69 51
                     <div>
70 52
                         <div id='reloadProgressBar'
@@ -76,7 +58,7 @@ class PageReloadOverlayImpl extends Overlay{
76 58
                             class='reload_overlay_msg'>
77 59
                         </span>
78 60
                     </div>
79
-                    ${button}
61
+                    ${this.buttonHtml}
80 62
                 </div>`;
81 63
     }
82 64
 
@@ -97,6 +79,9 @@ class PageReloadOverlayImpl extends Overlay{
97 79
      * @override
98 80
      */
99 81
     _onShow() {
82
+        $("#reconnectNow").click(() => {
83
+            APP.ConferenceUrl.reload();
84
+        });
100 85
 
101 86
         // Initialize displays
102 87
         this.updateDisplay();
@@ -128,42 +113,63 @@ class PageReloadOverlayImpl extends Overlay{
128 113
  */
129 114
 let overlay;
130 115
 
131
-export default {
132
-    /**
133
-     * Checks whether the page reload overlay has been displayed.
134
-     * @return {boolean} <tt>true</tt> if the page reload overlay is currently
135
-     * visible or <tt>false</tt> otherwise.
136
-     */
137
-    isVisible() {
116
+/**
117
+ * Checks whether the page reload overlay has been displayed.
118
+ * @return {boolean} <tt>true</tt> if the page reload overlay is currently
119
+ * visible or <tt>false</tt> otherwise.
120
+ */
121
+export function isVisible() {
138 122
         return overlay && overlay.isVisible();
139
-    },
140
-    /**
141
-     * Shows the page reload overlay which will do the conference reload after
142
-     * the given amount of time.
143
-     *
144
-     * @param {number} timeoutSeconds how many seconds before the conference
145
-     * reload will happen.
146
-     * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's
147
-     * caused by network related failure or <tt>false</tt> when it's
148
-     * the infrastructure.
149
-     * @param {string} reason a label string identifying the reason for the page
150
-     * reload which will be included in details of the log event
151
-     */
152
-    show(timeoutSeconds, isNetworkFailure, reason) {
153
-
154
-        if (!overlay) {
155
-            overlay
156
-                = new PageReloadOverlayImpl(timeoutSeconds, isNetworkFailure);
157
-        }
158
-        // Log the page reload event
159
-        if (!this.isVisible()) {
160
-            // FIXME (CallStats - issue) this event will not make it to
161
-            // the CallStats, because the log queue is not flushed, before
162
-            // "fabric terminated" is sent to the backed
163
-            APP.conference.logEvent(
164
-                'page.reload', undefined /* value */, reason /* label */);
165
-        }
166
-        // If it's a network failure we enable the light overlay.
167
-        overlay.show(isNetworkFailure);
123
+}
124
+
125
+/**
126
+ * Shows the page reload overlay which will do the conference reload after
127
+ * the given amount of time.
128
+ *
129
+ * @param {number} timeoutSeconds how many seconds before the conference
130
+ * reload will happen.
131
+ * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's
132
+ * caused by network related failure or <tt>false</tt> when it's
133
+ * the infrastructure.
134
+ * @param {string} reason a label string identifying the reason for the page
135
+ * reload which will be included in details of the log event
136
+ */
137
+export function show(timeoutSeconds, isNetworkFailure, reason) {
138
+    let title;
139
+    let message;
140
+    let buttonHtml;
141
+    let isLightOverlay;
142
+
143
+    if (isNetworkFailure) {
144
+        title = "dialog.conferenceDisconnectTitle";
145
+        message = "dialog.conferenceDisconnectMsg";
146
+        buttonHtml
147
+            = `<button id="reconnectNow" data-i18n="dialog.reconnectNow"
148
+                    class="button-control button-control_primary
149
+                            button-control_center"></button>`;
150
+        isLightOverlay = true;
151
+    }
152
+    else {
153
+        title = "dialog.conferenceReloadTitle";
154
+        message = "dialog.conferenceReloadMsg";
155
+        buttonHtml = "";
156
+        isLightOverlay = false;
157
+    }
158
+
159
+    if (!overlay) {
160
+        overlay = new PageReloadOverlayImpl(timeoutSeconds,
161
+                                            title,
162
+                                            message,
163
+                                            buttonHtml,
164
+                                            isLightOverlay);
165
+    }
166
+    // Log the page reload event
167
+    if (!this.isVisible()) {
168
+        // FIXME (CallStats - issue) this event will not make it to
169
+        // the CallStats, because the log queue is not flushed, before
170
+        // "fabric terminated" is sent to the backed
171
+        APP.conference.logEvent(
172
+            'page.reload', undefined /* value */, reason /* label */);
168 173
     }
169
-};
174
+    overlay.show();
175
+}

Carregando…
Cancelar
Salvar