Procházet zdrojové kódy

Minor fixes for error dialogs

j8
tsareg před 9 roky
rodič
revize
ccdba03888
2 změnil soubory, kde provedl 25 přidání a 16 odebrání
  1. 0
    2
      conference.js
  2. 25
    14
      modules/UI/UI.js

+ 0
- 2
conference.js Zobrazit soubor

@@ -1056,8 +1056,6 @@ export default {
1056 1056
                 this.useVideoStream(null);
1057 1057
                 this.videoSwitchInProgress = false;
1058 1058
                 console.error('failed to share local video', err);
1059
-
1060
-                APP.UI.showDeviceErrorDialog('camera', err);
1061 1059
             });
1062 1060
         }
1063 1061
     },

+ 25
- 14
modules/UI/UI.js Zobrazit soubor

@@ -1164,23 +1164,29 @@ UI.showDeviceErrorDialog = function (type, error) {
1164 1164
         throw new Error("Invalid device type");
1165 1165
     }
1166 1166
 
1167
-    if (window.localStorage[type + "DoNotShowErrorAgain-" + error.name]
1168
-        === "true") {
1167
+    if (error.name && error instanceof JitsiMeetJS.JitsiTrackError &&
1168
+        window.localStorage[type + "DoNotShowErrorAgain-" + error.name]
1169
+            === "true") {
1169 1170
         return;
1170 1171
     }
1171 1172
 
1172 1173
     let titleKey = error.name === TrackErrors.PERMISSION_DENIED
1173 1174
             ? "dialog.permissionDenied"
1174 1175
             : "dialog.error",
1175
-        errorMsg = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][error.name],
1176
-        doNotShowAgainMsg = "dialog.doNotShowWarningAgain",
1176
+        errorMsg = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][error.name] ||
1177
+            JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][TrackErrors.GENERAL],
1177 1178
         title = `<span data-i18n="${titleKey}"></span>`,
1178
-        message = `
1179
-            <h4 data-i18n="${errorMsg}"></h4>
1180
-            <label>
1181
-                <input type="checkbox" id="doNotShowWarningAgain">
1182
-                <span data-i18n="${doNotShowAgainMsg}"></span>
1183
-            </label>`;
1179
+        message = "<h4 data-i18n='" + errorMsg + "'></h4>" +
1180
+            (!JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][error.name]
1181
+            && error.message
1182
+                ? "<div>" + error.message + "</div>"
1183
+                : "") +
1184
+            "<label>" +
1185
+                "<input type='checkbox' id='doNotShowWarningAgain'> " +
1186
+                (error instanceof JitsiMeetJS.JitsiTrackError && error.name
1187
+                    ? "<span data-i18n='dialog.doNotShowWarningAgain'></span>"
1188
+                    : "") +
1189
+            "</label>";
1184 1190
 
1185 1191
     messageHandler.openDialog(
1186 1192
         title,
@@ -1188,11 +1194,16 @@ UI.showDeviceErrorDialog = function (type, error) {
1188 1194
         false,
1189 1195
         {Ok: true},
1190 1196
         function () {
1191
-            let form  = $.prompt.getPrompt(),
1192
-                input = form.find("#doNotShowWarningAgain");
1197
+            let form  = $.prompt.getPrompt();
1198
+
1199
+            if (form) {
1200
+                let input = form.find("#doNotShowWarningAgain");
1193 1201
 
1194
-            window.localStorage[type + "DoNotShowErrorAgain-" + error.name]
1195
-                = input.prop("checked");
1202
+                if (input.length) {
1203
+                    window.localStorage[type + "DoNotShowErrorAgain-"
1204
+                        + error.name] = input.prop("checked");
1205
+                }
1206
+            }
1196 1207
         }
1197 1208
     );
1198 1209
 

Načítá se…
Zrušit
Uložit