Bläddra i källkod

Fix problem with dialogs

j8
Ilya Daynatovich 8 år sedan
förälder
incheckning
8896b0adf3
2 ändrade filer med 58 tillägg och 57 borttagningar
  1. 53
    57
      modules/UI/UI.js
  2. 5
    0
      react/features/base/connection/actions.web.js

+ 53
- 57
modules/UI/UI.js Visa fil

@@ -83,57 +83,6 @@ JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.CONSTRAINT_FAILED]
83 83
 JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NO_DATA_FROM_SOURCE]
84 84
     = "dialog.micNotSendingData";
85 85
 
86
-/**
87
- * Prompt user for nickname.
88
- */
89
-function promptDisplayName() {
90
-    let labelKey = 'dialog.enterDisplayName';
91
-    let message = (
92
-        `<div class="form-control">
93
-            <label data-i18n="${labelKey}" class="form-control__label"></label>
94
-            <input name="displayName" type="text"
95
-               data-i18n="[placeholder]defaultNickname"
96
-               class="input-control" autofocus>
97
-         </div>`
98
-    );
99
-
100
-    // Don't use a translation string, because we're too early in the call and
101
-    // the translation may not be initialised.
102
-    let buttons = {Ok:true};
103
-
104
-    let dialog = messageHandler.openDialog(
105
-        'dialog.displayNameRequired',
106
-        message,
107
-        true,
108
-        buttons,
109
-        function (e, v, m, f) {
110
-            e.preventDefault();
111
-            if (v) {
112
-                let displayName = f.displayName;
113
-                if (displayName) {
114
-                    UI.inputDisplayNameHandler(displayName);
115
-                    dialog.close();
116
-                    return;
117
-                }
118
-            }
119
-        },
120
-        function () {
121
-            let form  = $.prompt.getPrompt();
122
-            let input = form.find("input[name='displayName']");
123
-            input.focus();
124
-            let button = form.find("button");
125
-            button.attr("disabled", "disabled");
126
-            input.keyup(function () {
127
-                if (input.val()) {
128
-                    button.removeAttr("disabled");
129
-                } else {
130
-                    button.attr("disabled", "disabled");
131
-                }
132
-            });
133
-        }
134
-    );
135
-}
136
-
137 86
 /**
138 87
  * Initialize toolbars with side panels.
139 88
  */
@@ -382,12 +331,6 @@ UI.start = function () {
382 331
 
383 332
     document.title = interfaceConfig.APP_NAME;
384 333
 
385
-    if(config.requireDisplayName) {
386
-        if (!APP.settings.getDisplayName()) {
387
-            promptDisplayName();
388
-        }
389
-    }
390
-
391 334
     if (!interfaceConfig.filmStripOnly) {
392 335
         toastr.options = {
393 336
             "closeButton": true,
@@ -916,6 +859,59 @@ UI.participantConnectionStatusChanged = function (id, isActive) {
916 859
     VideoLayout.onParticipantConnectionStatusChanged(id, isActive);
917 860
 };
918 861
 
862
+/**
863
+ * Prompt user for nickname.
864
+ */
865
+UI.promptDisplayName = () => {
866
+    const labelKey = 'dialog.enterDisplayName';
867
+    const message = (
868
+        `<div class="form-control">
869
+            <label data-i18n="${labelKey}" class="form-control__label"></label>
870
+            <input name="displayName" type="text"
871
+               data-i18n="[placeholder]defaultNickname"
872
+               class="input-control" autofocus>
873
+         </div>`
874
+    );
875
+
876
+    // Don't use a translation string, because we're too early in the call and
877
+    // the translation may not be initialised.
878
+    const buttons = { Ok: true };
879
+
880
+    const dialog = messageHandler.openDialog(
881
+        'dialog.displayNameRequired',
882
+        message,
883
+        true,
884
+        buttons,
885
+        (e, v, m, f) => {
886
+            e.preventDefault();
887
+            if (v) {
888
+                const displayName = f.displayName;
889
+
890
+                if (displayName) {
891
+                    UI.inputDisplayNameHandler(displayName);
892
+                    dialog.close();
893
+                    return;
894
+                }
895
+            }
896
+        },
897
+        () => {
898
+            const form  = $.prompt.getPrompt();
899
+            const input = form.find("input[name='displayName']");
900
+            const button = form.find("button");
901
+
902
+            input.focus();
903
+            button.attr("disabled", "disabled");
904
+            input.keyup(() => {
905
+                if (input.val()) {
906
+                    button.removeAttr("disabled");
907
+                } else {
908
+                    button.attr("disabled", "disabled");
909
+                }
910
+            });
911
+        }
912
+    );
913
+};
914
+
919 915
 /**
920 916
  * Update audio level visualization for specified user.
921 917
  * @param {string} id user id

+ 5
- 0
react/features/base/connection/actions.web.js Visa fil

@@ -12,6 +12,7 @@ import { appNavigate } from '../../app';
12 12
 import { setUnsupportedBrowser } from '../../unsupported-browser';
13 13
 
14 14
 declare var APP: Object;
15
+declare var config: Object;
15 16
 
16 17
 const logger = require('jitsi-meet-logger').getLogger(__filename);
17 18
 
@@ -71,6 +72,10 @@ export function connect() {
71 72
             });
72 73
 
73 74
             APP.keyboardshortcut.init();
75
+
76
+            if (config.requireDisplayName && !APP.settings.getDisplayName()) {
77
+                APP.UI.promptDisplayName();
78
+            }
74 79
         })
75 80
             .catch(err => {
76 81
                 APP.UI.hideRingOverLay();

Laddar…
Avbryt
Spara