Selaa lähdekoodia

Implements extension external installation for popup windows

j8
hristoterezov 8 vuotta sitten
vanhempi
commit
f899d16a79
4 muutettua tiedostoa jossa 80 lisäystä ja 4 poistoa
  1. 38
    2
      conference.js
  2. 4
    1
      lang/main.json
  3. 27
    0
      modules/UI/UI.js
  4. 11
    1
      service/UI/UIEvents.js

+ 38
- 2
conference.js Näytä tiedosto

33
  */
33
  */
34
 let connectionIsInterrupted = false;
34
 let connectionIsInterrupted = false;
35
 
35
 
36
+/**
37
+ * Indicates whether extension external installation is in progress or not.
38
+ */
39
+let DSExternalInstallationInProgress = false;
40
+
36
 import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
41
 import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
37
 
42
 
38
 /**
43
 /**
270
                 ? APP.settings.getMicDeviceId()
275
                 ? APP.settings.getMicDeviceId()
271
                 : options.micDeviceId,
276
                 : options.micDeviceId,
272
             // adds any ff fake device settings if any
277
             // adds any ff fake device settings if any
273
-            firefox_fake_device: config.firefox_fake_device
278
+            firefox_fake_device: config.firefox_fake_device,
279
+            desktopSharingExtensionExternalInstallation:
280
+                options.desktopSharingExtensionExternalInstallation
274
         }, checkForPermissionPrompt)
281
         }, checkForPermissionPrompt)
275
         .catch(function (err) {
282
         .catch(function (err) {
276
             console.error(
283
             console.error(
878
         }
885
         }
879
 
886
 
880
         this.videoSwitchInProgress = true;
887
         this.videoSwitchInProgress = true;
888
+        let externalInstallation = false;
881
 
889
 
882
         if (shareScreen) {
890
         if (shareScreen) {
883
-            createLocalTracks({ devices: ['desktop'] }).then(([stream]) => {
891
+            createLocalTracks({
892
+                devices: ['desktop'],
893
+                desktopSharingExtensionExternalInstallation: {
894
+                    interval: 500,
895
+                    checkAgain: () => {
896
+                        return DSExternalInstallationInProgress;
897
+                    },
898
+                    listener: (url) => {
899
+                        DSExternalInstallationInProgress = true;
900
+                        externalInstallation = true;
901
+                        APP.UI.showExtensionExternalInstallationDialog(url);
902
+                    }
903
+                }
904
+            }).then(([stream]) => {
905
+                DSExternalInstallationInProgress = false;
906
+                // close external installation dialog on success.
907
+                if(externalInstallation)
908
+                    $.prompt.close();
884
                 stream.on(
909
                 stream.on(
885
                     TrackEvents.LOCAL_TRACK_STOPPED,
910
                     TrackEvents.LOCAL_TRACK_STOPPED,
886
                     () => {
911
                     () => {
1134
             APP.UI.updateDTMFSupport(isDTMFSupported);
1159
             APP.UI.updateDTMFSupport(isDTMFSupported);
1135
         });
1160
         });
1136
 
1161
 
1162
+        APP.UI.addListener(UIEvents.EXTERNAL_INSTALLATION_CANCELED, () => {
1163
+            // Wait a little bit more just to be sure that we won't miss the
1164
+            // extension installation
1165
+            setTimeout(() => DSExternalInstallationInProgress = false, 500);
1166
+        });
1167
+        APP.UI.addListener(UIEvents.OPEN_EXTENSION_STORE, (url) => {
1168
+            window.open(
1169
+                url, "extension_store_window",
1170
+                "resizable,scrollbars=yes,status=1");
1171
+        });
1172
+
1137
         APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => {
1173
         APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => {
1138
             if (room.isModerator()) {
1174
             if (room.isModerator()) {
1139
                 let promise = roomLocker.isLocked
1175
                 let promise = roomLocker.isLocked

+ 4
- 1
lang/main.json Näytä tiedosto

263
         "micUnknownError": "Cannot use microphone for a unknown reason.",
263
         "micUnknownError": "Cannot use microphone for a unknown reason.",
264
         "micPermissionDeniedError": "You have not granted permission to use your microphone. You can still join the conference but others won't hear you. Use the camera button in the address bar to fix this.",
264
         "micPermissionDeniedError": "You have not granted permission to use your microphone. You can still join the conference but others won't hear you. Use the camera button in the address bar to fix this.",
265
         "micNotFoundError": "Requested microphone was not found.",
265
         "micNotFoundError": "Requested microphone was not found.",
266
-        "micConstraintFailedError": "Yor microphone does not satisfy some of required constraints."
266
+        "micConstraintFailedError": "Yor microphone does not satisfy some of required constraints.",
267
+        "goToStore": "Go to the webstore",
268
+        "externalInstallationTitle": "Extension required",
269
+        "externalInstallationMsg": "You need to install our desktop sharing extension."
267
     },
270
     },
268
     "email":
271
     "email":
269
     {
272
     {

+ 27
- 0
modules/UI/UI.js Näytä tiedosto

1213
             "dialog.firefoxExtensionPrompt", {url: url}));
1213
             "dialog.firefoxExtensionPrompt", {url: url}));
1214
 };
1214
 };
1215
 
1215
 
1216
+/**
1217
+ * Shows "Please go to chrome webstore to install the desktop sharing extension"
1218
+ * 2 button dialog with buttons - cancel and go to web store.
1219
+ * @param url {string} the url of the extension.
1220
+ */
1221
+UI.showExtensionExternalInstallationDialog = function (url) {
1222
+    messageHandler.openTwoButtonDialog(
1223
+        "dialog.externalInstallationTitle",
1224
+        null,
1225
+        "dialog.externalInstallationMsg",
1226
+        null,
1227
+        true,
1228
+        "dialog.goToStore",
1229
+         function(e,v,m,f){
1230
+            if (v) {
1231
+                e.preventDefault();
1232
+                eventEmitter.emit(UIEvents.OPEN_EXTENSION_STORE, url);
1233
+            }
1234
+        },
1235
+        function () {},
1236
+        function () {
1237
+            eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
1238
+        }
1239
+    );
1240
+};
1241
+
1242
+
1216
 /**
1243
 /**
1217
  * Shows dialog with combined information about camera and microphone errors.
1244
  * Shows dialog with combined information about camera and microphone errors.
1218
  * @param {JitsiTrackError} micError
1245
  * @param {JitsiTrackError} micError

+ 11
- 1
service/UI/UIEvents.js Näytä tiedosto

83
     LOCAL_FLIPX_CHANGED: "UI.local_flipx_changed",
83
     LOCAL_FLIPX_CHANGED: "UI.local_flipx_changed",
84
     // An event which indicates that the resolution of a remote video has
84
     // An event which indicates that the resolution of a remote video has
85
     // changed.
85
     // changed.
86
-    RESOLUTION_CHANGED: "UI.resolution_changed"
86
+    RESOLUTION_CHANGED: "UI.resolution_changed",
87
+    /**
88
+     * Notifies that the button "Go to webstore" is pressed on the dialog for
89
+     * external extension installation.
90
+     */
91
+    OPEN_EXTENSION_STORE: "UI.open_extension_store",
92
+    /**
93
+     * Notifies that the button "Cancel" is pressed on the dialog for
94
+     * external extension installation.
95
+     */
96
+    EXTERNAL_INSTALLATION_CANCELED: "UI.external_installation_canceled"
87
 };
97
 };

Loading…
Peruuta
Tallenna