Merge branch 'master' into SDA-1841

This commit is contained in:
mattias-symphony 2020-03-10 12:04:05 +01:00 committed by GitHub
commit 59e9e4986f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 20 deletions

20
package-lock.json generated
View File

@ -4470,13 +4470,13 @@
"dev": true "dev": true
}, },
"diskusage": { "diskusage": {
"version": "1.1.2", "version": "1.1.3",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/diskusage/-/diskusage-1.1.2.tgz", "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/diskusage/-/diskusage-1.1.3.tgz",
"integrity": "sha1-4cWRrmF1E/74HWIPRY8We55ekeY=", "integrity": "sha1-aA19vxtnkWihlckkDrNVLL0sBns=",
"optional": true, "optional": true,
"requires": { "requires": {
"es6-promise": "^4.2.5", "es6-promise": "^4.2.5",
"nan": "^2.13.2" "nan": "^2.14.0"
} }
}, },
"dmg-builder": { "dmg-builder": {
@ -13158,8 +13158,8 @@
} }
}, },
"screen-share-indicator-frame": { "screen-share-indicator-frame": {
"version": "1.4.0", "version": "1.4.1",
"resolved": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#adc3fdb0fa96629773ea2bc13b20b9ffd109ac1d", "resolved": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#891c5846fcdb1e2788bebf062f0ddb1b44eec67d",
"optional": true, "optional": true,
"requires": { "requires": {
"run-script-os": "1.0.7" "run-script-os": "1.0.7"
@ -13997,12 +13997,12 @@
} }
}, },
"swift-search": { "swift-search": {
"version": "2.0.1", "version": "2.0.2",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/swift-search/-/swift-search-2.0.1.tgz", "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/swift-search/-/swift-search-2.0.2.tgz",
"integrity": "sha1-yWDXbBkFa9JuhQRd4Ei8ro0/HFw=", "integrity": "sha1-sVs8wouzV7LDacnbZfQ91V/8DxU=",
"optional": true, "optional": true,
"requires": { "requires": {
"diskusage": "1.1.2", "diskusage": "1.1.3",
"electron-log": "2.2.16", "electron-log": "2.2.16",
"ffi-napi": "2.4.5", "ffi-napi": "2.4.5",
"keymirror": "0.1.1", "keymirror": "0.1.1",

View File

@ -289,13 +289,14 @@ export const removeWindowEventListener = (window: BrowserWindow): void => {
* @param message {string} - custom message displayed to the user * @param message {string} - custom message displayed to the user
* @param callback {function} * @param callback {function}
*/ */
export const handleSessionPermissions = (permission: boolean, message: string, callback: (permission: boolean) => void): void => { export const handleSessionPermissions = async (permission: boolean, message: string, callback: (permission: boolean) => void): Promise<void> => {
logger.info(`window-action: permission is ->`, { type: message, permission }); logger.info(`window-action: permission is ->`, { type: message, permission });
if (!permission) { if (!permission) {
const browserWindow = BrowserWindow.getFocusedWindow(); const browserWindow = BrowserWindow.getFocusedWindow();
if (browserWindow && !browserWindow.isDestroyed()) { if (browserWindow && !browserWindow.isDestroyed()) {
dialog.showMessageBox(browserWindow, { type: 'error', title: `${i18n.t('Permission Denied')()}!`, message }); const response = await dialog.showMessageBox(browserWindow, { type: 'error', title: `${i18n.t('Permission Denied')()}!`, message });
logger.error(`window-actions: permissions message box closed with response`, response);
} }
} }

View File

@ -60,11 +60,11 @@ export const preventWindowNavigation = (browserWindow: BrowserWindow, isPopOutWi
if (!browserWindow || !windowExists(browserWindow)) { if (!browserWindow || !windowExists(browserWindow)) {
return; return;
} }
logger.info(`window-utils: preventing window from navigating!`); logger.info(`window-utils: preventing window from navigating!`, isPopOutWindow);
const listener = (e: Electron.Event, winUrl: string) => { const listener = async (e: Electron.Event, winUrl: string) => {
if (!winUrl.startsWith('http' || 'https')) { if (!winUrl.startsWith('http' || 'https')) {
logger.info(`window-utils: ${winUrl} doesn't start with http or https, so, not navigating!`); logger.error(`window-utils: ${winUrl} doesn't start with http or https, so, not navigating!`);
e.preventDefault(); e.preventDefault();
return; return;
} }
@ -74,13 +74,13 @@ export const preventWindowNavigation = (browserWindow: BrowserWindow, isPopOutWi
if (!isValid) { if (!isValid) {
e.preventDefault(); e.preventDefault();
if (browserWindow && windowExists(browserWindow)) { if (browserWindow && windowExists(browserWindow)) {
// @ts-ignore const response = await electron.dialog.showMessageBox(browserWindow, {
electron.dialog.showMessageBox(browserWindow, {
type: 'warning', type: 'warning',
buttons: [ 'OK' ], buttons: [ 'OK' ],
title: i18n.t('Not Allowed')(), title: i18n.t('Not Allowed')(),
message: `${i18n.t(`Sorry, you are not allowed to access this website`)} (${winUrl}), ${i18n.t('please contact your administrator for more details')}`, message: `${i18n.t(`Sorry, you are not allowed to access this website`)()} (${winUrl}), ${i18n.t('please contact your administrator for more details')()}`,
}); });
logger.info(`window-utils: received ${response} response from dialog`);
} }
} }
} }
@ -90,8 +90,6 @@ export const preventWindowNavigation = (browserWindow: BrowserWindow, isPopOutWi
|| winUrl === browserWindow.webContents.getURL()) { || winUrl === browserWindow.webContents.getURL()) {
return; return;
} }
e.preventDefault();
}; };
browserWindow.webContents.on('will-navigate', listener); browserWindow.webContents.on('will-navigate', listener);