Implements extension external installation for popup windows

This commit is contained in:
hristoterezov 2016-08-10 14:13:32 -05:00
parent a50a980de4
commit f899d16a79
4 changed files with 80 additions and 4 deletions

View File

@ -33,6 +33,11 @@ let room, connection, localAudio, localVideo, roomLocker;
*/ */
let connectionIsInterrupted = false; let connectionIsInterrupted = false;
/**
* Indicates whether extension external installation is in progress or not.
*/
let DSExternalInstallationInProgress = false;
import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo"; import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
/** /**
@ -270,7 +275,9 @@ function createLocalTracks (options, checkForPermissionPrompt) {
? APP.settings.getMicDeviceId() ? APP.settings.getMicDeviceId()
: options.micDeviceId, : options.micDeviceId,
// adds any ff fake device settings if any // adds any ff fake device settings if any
firefox_fake_device: config.firefox_fake_device firefox_fake_device: config.firefox_fake_device,
desktopSharingExtensionExternalInstallation:
options.desktopSharingExtensionExternalInstallation
}, checkForPermissionPrompt) }, checkForPermissionPrompt)
.catch(function (err) { .catch(function (err) {
console.error( console.error(
@ -878,9 +885,27 @@ export default {
} }
this.videoSwitchInProgress = true; this.videoSwitchInProgress = true;
let externalInstallation = false;
if (shareScreen) { if (shareScreen) {
createLocalTracks({ devices: ['desktop'] }).then(([stream]) => { createLocalTracks({
devices: ['desktop'],
desktopSharingExtensionExternalInstallation: {
interval: 500,
checkAgain: () => {
return DSExternalInstallationInProgress;
},
listener: (url) => {
DSExternalInstallationInProgress = true;
externalInstallation = true;
APP.UI.showExtensionExternalInstallationDialog(url);
}
}
}).then(([stream]) => {
DSExternalInstallationInProgress = false;
// close external installation dialog on success.
if(externalInstallation)
$.prompt.close();
stream.on( stream.on(
TrackEvents.LOCAL_TRACK_STOPPED, TrackEvents.LOCAL_TRACK_STOPPED,
() => { () => {
@ -1134,6 +1159,17 @@ export default {
APP.UI.updateDTMFSupport(isDTMFSupported); APP.UI.updateDTMFSupport(isDTMFSupported);
}); });
APP.UI.addListener(UIEvents.EXTERNAL_INSTALLATION_CANCELED, () => {
// Wait a little bit more just to be sure that we won't miss the
// extension installation
setTimeout(() => DSExternalInstallationInProgress = false, 500);
});
APP.UI.addListener(UIEvents.OPEN_EXTENSION_STORE, (url) => {
window.open(
url, "extension_store_window",
"resizable,scrollbars=yes,status=1");
});
APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => { APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => {
if (room.isModerator()) { if (room.isModerator()) {
let promise = roomLocker.isLocked let promise = roomLocker.isLocked

View File

@ -263,7 +263,10 @@
"micUnknownError": "Cannot use microphone for a unknown reason.", "micUnknownError": "Cannot use microphone for a unknown reason.",
"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.", "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.",
"micNotFoundError": "Requested microphone was not found.", "micNotFoundError": "Requested microphone was not found.",
"micConstraintFailedError": "Yor microphone does not satisfy some of required constraints." "micConstraintFailedError": "Yor microphone does not satisfy some of required constraints.",
"goToStore": "Go to the webstore",
"externalInstallationTitle": "Extension required",
"externalInstallationMsg": "You need to install our desktop sharing extension."
}, },
"email": "email":
{ {

View File

@ -1213,6 +1213,33 @@ UI.showExtensionRequiredDialog = function (url) {
"dialog.firefoxExtensionPrompt", {url: url})); "dialog.firefoxExtensionPrompt", {url: url}));
}; };
/**
* Shows "Please go to chrome webstore to install the desktop sharing extension"
* 2 button dialog with buttons - cancel and go to web store.
* @param url {string} the url of the extension.
*/
UI.showExtensionExternalInstallationDialog = function (url) {
messageHandler.openTwoButtonDialog(
"dialog.externalInstallationTitle",
null,
"dialog.externalInstallationMsg",
null,
true,
"dialog.goToStore",
function(e,v,m,f){
if (v) {
e.preventDefault();
eventEmitter.emit(UIEvents.OPEN_EXTENSION_STORE, url);
}
},
function () {},
function () {
eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
}
);
};
/** /**
* Shows dialog with combined information about camera and microphone errors. * Shows dialog with combined information about camera and microphone errors.
* @param {JitsiTrackError} micError * @param {JitsiTrackError} micError

View File

@ -83,5 +83,15 @@ export default {
LOCAL_FLIPX_CHANGED: "UI.local_flipx_changed", LOCAL_FLIPX_CHANGED: "UI.local_flipx_changed",
// An event which indicates that the resolution of a remote video has // An event which indicates that the resolution of a remote video has
// changed. // changed.
RESOLUTION_CHANGED: "UI.resolution_changed" RESOLUTION_CHANGED: "UI.resolution_changed",
/**
* Notifies that the button "Go to webstore" is pressed on the dialog for
* external extension installation.
*/
OPEN_EXTENSION_STORE: "UI.open_extension_store",
/**
* Notifies that the button "Cancel" is pressed on the dialog for
* external extension installation.
*/
EXTERNAL_INSTALLATION_CANCELED: "UI.external_installation_canceled"
}; };