|
@@ -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
|
+}
|