浏览代码

Merge pull request #1184 from jitsi/separate-disconnect-overlay

Separate disconnect overlay
master
hristoterezov 8 年前
父节点
当前提交
a6fed4da65

+ 8
- 0
css/_mixins.scss 查看文件

@@ -150,4 +150,12 @@
150 150
   overflow: hidden;
151 151
   text-overflow: ellipsis;
152 152
   white-space: nowrap;
153
+}
154
+
155
+/**
156
+ * Creates a semi-transparent background with the given color and alpha
157
+ * (opacity) value.
158
+ */
159
+@mixin transparentBg($color, $alpha) {
160
+  background-color: rgba(red($color), green($color), blue($color), $alpha);
153 161
 }

+ 4
- 0
css/components/_button-control.scss 查看文件

@@ -82,4 +82,8 @@
82 82
             color: $linkHoverFontColor;
83 83
         }
84 84
     }
85
+
86
+    &_center {
87
+        float: none !important;
88
+    }
85 89
 }

+ 6
- 1
css/overlay/_overlay.scss 查看文件

@@ -1,5 +1,6 @@
1 1
 .overlay {
2
-    &__container {
2
+    &__container,
3
+    &__container-light {
3 4
         top: 0;
4 5
         left: 0;
5 6
         width: 100%;
@@ -9,6 +10,10 @@
9 10
         background: $defaultBackground;
10 11
     }
11 12
 
13
+    &__container-light {
14
+        @include transparentBg($defaultBackground, 0.7);
15
+    }
16
+
12 17
     &__content {
13 18
         position: absolute;
14 19
         margin: 0 auto;

+ 3
- 0
lang/main.json 查看文件

@@ -215,6 +215,9 @@
215 215
         "failedpermissions": "Failed to obtain permissions to use the local microphone and/or camera.",
216 216
         "conferenceReloadTitle": "Unfortunately, something went wrong",
217 217
         "conferenceReloadMsg": "We're trying to fix this",
218
+        "conferenceDisconnectTitle": "You have been disconnected. You may want to check your network connection.",
219
+        "conferenceDisconnectMsg": "Reconnecting in...",
220
+        "reconnectNow": "Reconnect now",
218 221
         "conferenceReloadTimeLeft": "__seconds__ sec.",
219 222
         "maxUsersLimitReached": "The limit for maximum number of participants in the conference has been reached. The conference is full. Please try again later!",
220 223
         "lockTitle": "Lock failed",

+ 1
- 1
modules/UI/UI.js 查看文件

@@ -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";

+ 18
- 6
modules/UI/overlay/Overlay.js 查看文件

@@ -15,26 +15,38 @@ 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 '';
28 35
     }
29 36
     /**
30 37
      * Constructs the HTML body of the overlay dialog.
38
+     *
39
+     * @private
31 40
      */
32
-    buildOverlayHtml() {
41
+    _buildOverlayHtml() {
33 42
 
34 43
         let overlayContent = this._buildOverlayContent();
35 44
 
45
+        let containerClass = this.isLightOverlay    ? "overlay__container-light"
46
+                                                    : "overlay__container";
47
+
36 48
         this.$overlay = $(`
37
-            <div class='overlay__container'>
49
+            <div class=${containerClass}>
38 50
                 <div class='overlay__content'>
39 51
                     ${overlayContent}
40 52
                 </div>
@@ -53,18 +65,18 @@ export default class Overlay{
53 65
     /**
54 66
      * Template method called just after the overlay is displayed for the first
55 67
      * time.
56
-     * @private
68
+     * @protected
57 69
      */
58 70
     _onShow() {
59 71
         // To be overridden by subclasses.
60 72
     }
61 73
     /**
62
-     * Shows the overlay dialog adn attaches the underlying HTML representation
74
+     * Shows the overlay dialog and attaches the underlying HTML representation
63 75
      * to the DOM.
64 76
      */
65 77
     show() {
66 78
 
67
-        !this.$overlay && this.buildOverlayHtml();
79
+        !this.$overlay && this._buildOverlayHtml();
68 80
 
69 81
         if (!this.isVisible()) {
70 82
             this.$overlay.appendTo('body');

+ 77
- 39
modules/UI/reload_overlay/PageReloadOverlay.js 查看文件

@@ -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,8 +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 {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
15 21
      */
16
-    constructor(timeoutSeconds) {
22
+    constructor(timeoutSeconds, title, message, buttonHtml, isLightOverlay) {
17 23
         super();
18 24
         /**
19 25
          * Conference reload counter in seconds.
@@ -25,6 +31,11 @@ class PageReloadOverlayImpl extends Overlay{
25 31
          * @type {number}
26 32
          */
27 33
         this.timeout = timeoutSeconds;
34
+
35
+        this.title = title;
36
+        this.message = message;
37
+        this.buttonHtml = buttonHtml;
38
+        this.isLightOverlay = isLightOverlay;
28 39
     }
29 40
     /**
30 41
      * Constructs overlay body with the warning message and count down towards
@@ -33,9 +44,9 @@ class PageReloadOverlayImpl extends Overlay{
33 44
      */
34 45
     _buildOverlayContent() {
35 46
         return `<div class="inlay">
36
-                    <span data-i18n='dialog.conferenceReloadTitle'
47
+                    <span data-i18n=${this.title}
37 48
                           class='reload_overlay_title'></span>
38
-                    <span data-i18n='dialog.conferenceReloadMsg'
49
+                    <span data-i18n=${this.message}
39 50
                           class='reload_overlay_msg'></span>
40 51
                     <div>
41 52
                         <div id='reloadProgressBar'
@@ -47,6 +58,7 @@ class PageReloadOverlayImpl extends Overlay{
47 58
                             class='reload_overlay_msg'>
48 59
                         </span>
49 60
                     </div>
61
+                    ${this.buttonHtml}
50 62
                 </div>`;
51 63
     }
52 64
 
@@ -67,6 +79,9 @@ class PageReloadOverlayImpl extends Overlay{
67 79
      * @override
68 80
      */
69 81
     _onShow() {
82
+        $("#reconnectNow").click(() => {
83
+            APP.ConferenceUrl.reload();
84
+        });
70 85
 
71 86
         // Initialize displays
72 87
         this.updateDisplay();
@@ -98,40 +113,63 @@ class PageReloadOverlayImpl extends Overlay{
98 113
  */
99 114
 let overlay;
100 115
 
101
-export default {
102
-    /**
103
-     * Checks whether the page reload overlay has been displayed.
104
-     * @return {boolean} <tt>true</tt> if the page reload overlay is currently
105
-     * visible or <tt>false</tt> otherwise.
106
-     */
107
-    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() {
108 122
         return overlay && overlay.isVisible();
109
-    },
110
-    /**
111
-     * Shows the page reload overlay which will do the conference reload after
112
-     * the given amount of time.
113
-     *
114
-     * @param {number} timeoutSeconds how many seconds before the conference
115
-     * reload will happen.
116
-     * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's
117
-     * caused by network related failure or <tt>false</tt> when it's
118
-     * the infrastructure.
119
-     * @param {string} reason a label string identifying the reason for the page
120
-     * reload which will be included in details of the log event
121
-     */
122
-    show(timeoutSeconds, isNetworkFailure, reason) {
123
-
124
-        if (!overlay) {
125
-            overlay = new PageReloadOverlayImpl(timeoutSeconds);
126
-        }
127
-        // Log the page reload event
128
-        if (!this.isVisible()) {
129
-            // FIXME (CallStats - issue) this event will not make it to
130
-            // the CallStats, because the log queue is not flushed, before
131
-            // "fabric terminated" is sent to the backed
132
-            APP.conference.logEvent(
133
-                'page.reload', undefined /* value */, reason /* label */);
134
-        }
135
-        overlay.show();
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;
136 157
     }
137
-};
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 */);
173
+    }
174
+    overlay.show();
175
+}

正在加载...
取消
保存