cleanup: Remove obsolete code related to SS extension

- Remove external install dialogs and fix related screensharing error handling.
- Remove obsolete options from config.js and from configWhitelist.js
This commit is contained in:
Jaya Allamsetty 2020-06-18 19:15:49 -04:00 committed by Jaya Allamsetty
parent 6fbba52c6d
commit 07cad2a98f
7 changed files with 15 additions and 206 deletions

View File

@ -1,4 +1,4 @@
/* global $, APP, JitsiMeetJS, config, interfaceConfig */
/* global APP, JitsiMeetJS, config, interfaceConfig */
import EventEmitter from 'events';
import Logger from 'jitsi-meet-logger';
@ -1642,8 +1642,6 @@ export default {
* @private
*/
_createDesktopTrack(options = {}) {
let externalInstallation = false;
let DSExternalInstallationInProgress = false;
const didHaveVideo = !this.isLocalVideoMuted();
const getDesktopStreamPromise = options.desktopStream
@ -1652,43 +1650,7 @@ export default {
desktopSharingSourceDevice: options.desktopSharingSources
? null : config._desktopSharingSourceDevice,
desktopSharingSources: options.desktopSharingSources,
devices: [ 'desktop' ],
desktopSharingExtensionExternalInstallation: {
interval: 500,
checkAgain: () => DSExternalInstallationInProgress,
listener: (status, url) => {
switch (status) {
case 'waitingForExtension': {
DSExternalInstallationInProgress = true;
externalInstallation = true;
const listener = () => {
// Wait a little bit more just to be sure that
// we won't miss the extension installation
setTimeout(() => {
DSExternalInstallationInProgress = false;
},
500);
APP.UI.removeListener(
UIEvents.EXTERNAL_INSTALLATION_CANCELED,
listener);
};
APP.UI.addListener(
UIEvents.EXTERNAL_INSTALLATION_CANCELED,
listener);
APP.UI.showExtensionExternalInstallationDialog(url);
break;
}
case 'extensionFound':
// Close the dialog.
externalInstallation && $.prompt.close();
break;
default:
// Unknown status
}
}
}
devices: [ 'desktop' ]
});
return getDesktopStreamPromise.then(desktopStreams => {
@ -1712,15 +1674,8 @@ export default {
);
}
// close external installation dialog on success.
externalInstallation && $.prompt.close();
return desktopStreams;
}, error => {
DSExternalInstallationInProgress = false;
// close external installation dialog on success.
externalInstallation && $.prompt.close();
throw error;
});
},
@ -1924,70 +1879,36 @@ export default {
/**
* Handles {@link JitsiTrackError} returned by the lib-jitsi-meet when
* trying to create screensharing track. It will either do nothing if
* the dialog was canceled on user's request or display inline installation
* dialog and ask the user to install the extension, once the extension is
* installed it will switch the conference to screensharing. The last option
* is that an unrecoverable error dialog will be displayed.
* the dialog was canceled on user's request or display an error if
* screensharing couldn't be started.
* @param {JitsiTrackError} error - The error returned by
* {@link _createDesktopTrack} Promise.
* @private
*/
_handleScreenSharingError(error) {
if (error.name === JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED) {
if (error.name === JitsiTrackErrors.SCREENSHARING_USER_CANCELED) {
return;
}
logger.error('failed to share local desktop', error);
if (error.name
=== JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED) {
// If start with screen sharing the extension will fail to install
// (if not found), because the request has been triggered by the
// script. Show a dialog which asks user to click "install" and try
// again switching to the screen sharing.
APP.UI.showExtensionInlineInstallationDialog(
() => {
// eslint-disable-next-line no-empty-function
this.toggleScreenSharing().catch(() => {});
}
);
return;
}
// Handling:
// JitsiTrackErrors.PERMISSION_DENIED
// JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR
// JitsiTrackErrors.CONSTRAINT_FAILED
// JitsiTrackErrors.GENERAL
// JitsiTrackErrors.PERMISSION_DENIED
// JitsiTrackErrors.SCREENSHARING_GENERIC_ERROR
// and any other
let descriptionKey;
let titleKey;
if (error.name === JitsiTrackErrors.PERMISSION_DENIED) {
// in FF the only option for user is to deny access temporary or
// permanently and we only receive permission_denied
// we always show some info cause in case of permanently, no info
// shown will be bad experience
//
// TODO: detect interval between requesting permissions and received
// error, this way we can detect user interaction which will have
// longer delay
if (JitsiMeetJS.util.browser.isFirefox()) {
descriptionKey
= 'dialog.screenSharingFirefoxPermissionDeniedError';
titleKey = 'dialog.screenSharingFirefoxPermissionDeniedTitle';
} else {
descriptionKey = 'dialog.screenSharingPermissionDeniedError';
titleKey = 'dialog.screenSharingFailedToInstallTitle';
}
titleKey = 'dialog.screenSharingFailedTitle';
} else if (error.name === JitsiTrackErrors.CONSTRAINT_FAILED) {
descriptionKey = 'dialog.cameraConstraintFailedError';
titleKey = 'deviceError.cameraError';
} else {
descriptionKey = 'dialog.screenSharingFailedToInstall';
titleKey = 'dialog.screenSharingFailedToInstallTitle';
} else if (error.name === JitsiTrackErrors.SCREENSHARING_GENERIC_ERROR) {
descriptionKey = 'dialog.screenSharingFailed';
titleKey = 'dialog.screenSharingFailedTitle';
}
APP.UI.messageHandler.showError({

View File

@ -154,22 +154,6 @@ var config = {
// Desktop sharing
// The ID of the jidesha extension for Chrome.
desktopSharingChromeExtId: null,
// Whether desktop sharing should be disabled on Chrome.
// desktopSharingChromeDisabled: false,
// The media sources to use when using screen sharing with the Chrome
// extension.
desktopSharingChromeSources: [ 'screen', 'window', 'tab' ],
// Required version of Chrome extension
desktopSharingChromeMinExtVersion: '0.1',
// Whether desktop sharing should be disabled on Firefox.
// desktopSharingFirefoxDisabled: false,
// Optional desktop sharing frame rate options. Default value: min:5, max:5.
// desktopSharingFrameRate: {
// min: 5,

View File

@ -202,15 +202,10 @@
"e2eeWarning": "WARNING: Not all participants in this meeting seem to have support for End-to-End encryption. If you enable it they won't be able to see nor hear you.",
"enterDisplayName": "Please enter your name here",
"error": "Error",
"externalInstallationMsg": "You need to install our desktop sharing extension.",
"externalInstallationTitle": "Extension required",
"goToStore": "Go to the webstore",
"gracefulShutdown": "Our service is currently down for maintenance. Please try again later.",
"IamHost": "I am the host",
"incorrectRoomLockPassword": "Incorrect password",
"incorrectPassword": "Incorrect username or password",
"inlineInstallationMsg": "You need to install our desktop sharing extension.",
"inlineInstallExtension": "Install now",
"internalError": "Oops! Something went wrong. The following error occurred: {{error}}",
"internalErrorTitle": "Internal error",
"kickMessage": "You can contact {{participantDisplayName}} for more details.",
@ -272,11 +267,9 @@
"reservationErrorMsg": "Error code: {{code}}, message: {{msg}}",
"retry": "Retry",
"screenSharingAudio": "Share audio",
"screenSharingFailedToInstall": "Oops! Your screen sharing extension failed to install.",
"screenSharingFailedToInstallTitle": "Screen sharing extension failed to install",
"screenSharingFirefoxPermissionDeniedError": "Something went wrong while we were trying to share your screen. Please make sure that you have given us permission to do so.",
"screenSharingFirefoxPermissionDeniedTitle": "Oops! We werent able to start screen sharing!",
"screenSharingPermissionDeniedError": "Oops! Something went wrong with your screen sharing extension permissions. Please reload and try again.",
"screenSharingFailed": "Oops! Something went wrong, we werent able to start screen sharing!",
"screenSharingFailedTitle": "Screen sharing failed!",
"screenSharingPermissionDeniedError": "Oops! Something went wrong with your screen sharing permissions. Please reload and try again.",
"sendPrivateMessage": "You recently received a private message. Did you intend to reply to that privately, or you want to send your message to the group?",
"sendPrivateMessageCancel": "Send to the group",
"sendPrivateMessageOk": "Send privately",

View File

@ -553,82 +553,6 @@ UI.getLargeVideo = function() {
return VideoLayout.getLargeVideo();
};
/**
* 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) {
let openedWindow = null;
const submitFunction = function(e, v) {
if (v) {
e.preventDefault();
if (openedWindow === null || openedWindow.closed) {
openedWindow
= window.open(
url,
'extension_store_window',
'resizable,scrollbars=yes,status=1');
} else {
openedWindow.focus();
}
}
};
const closeFunction = function(e, v) {
if (openedWindow) {
// Ideally we would close the popup, but this does not seem to work
// on Chrome. Leaving it uncommented in case it could work
// in some version.
openedWindow.close();
openedWindow = null;
}
if (!v) {
eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
}
};
messageHandler.openTwoButtonDialog({
titleKey: 'dialog.externalInstallationTitle',
msgKey: 'dialog.externalInstallationMsg',
leftButtonKey: 'dialog.goToStore',
submitFunction,
loadedFunction: $.noop,
closeFunction
});
};
/**
* Shows a dialog which asks user to install the extension. This one is
* displayed after installation is triggered from the script, but fails because
* it must be initiated by user gesture.
* @param callback {function} function to be executed after user clicks
* the install button - it should make another attempt to install the extension.
*/
UI.showExtensionInlineInstallationDialog = function(callback) {
const submitFunction = function(e, v) {
if (v) {
callback();
}
};
const closeFunction = function(e, v) {
if (!v) {
eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
}
};
messageHandler.openTwoButtonDialog({
titleKey: 'dialog.externalInstallationTitle',
msgKey: 'dialog.inlineInstallationMsg',
leftButtonKey: 'dialog.inlineInstallExtension',
submitFunction,
loadedFunction: $.noop,
closeFunction
});
};
/**
* Show shared video.
* @param {string} id the id of the sender of the command

View File

@ -72,11 +72,6 @@ export default [
'debug',
'debugAudioLevels',
'defaultLanguage',
'desktopSharingChromeDisabled',
'desktopSharingChromeExtId',
'desktopSharingChromeMinExtVersion',
'desktopSharingChromeSources',
'desktopSharingFirefoxDisabled',
'desktopSharingFrameRate',
'desktopSharingSources',
'disable1On1Mode',

View File

@ -104,8 +104,6 @@ export function createLocalTracksF(options = {}, firePermissionPromptIsShownEven
{
cameraDeviceId,
constraints,
desktopSharingExtensionExternalInstallation:
options.desktopSharingExtensionExternalInstallation,
desktopSharingFrameRate,
desktopSharingSourceDevice:
options.desktopSharingSourceDevice,

View File

@ -53,12 +53,6 @@ export default {
*/
LOCAL_FLIPX_CHANGED: 'UI.local_flipx_changed',
/**
* Notifies that the button "Cancel" is pressed on the dialog for
* external extension installation.
*/
EXTERNAL_INSTALLATION_CANCELED: 'UI.external_installation_canceled',
/**
* Notifies that the side toolbar container has been toggled. The actual
* event must contain the identifier of the container that has been toggled