diff --git a/electron/src/calling/PictureInPictureCall.ts b/electron/src/calling/PictureInPictureCall.ts index 70f8b82646a..c5940228c2e 100644 --- a/electron/src/calling/PictureInPictureCall.ts +++ b/electron/src/calling/PictureInPictureCall.ts @@ -17,8 +17,21 @@ * */ +import {getNewWindowOptions} from '../window/WindowUtil'; + const PICTURE_IN_PICTURE_CALL_FRAME_NAME = 'WIRE_PICTURE_IN_PICTURE_CALL'; export const isPictureInPictureCallWindow = (frameName: string): boolean => { return frameName === PICTURE_IN_PICTURE_CALL_FRAME_NAME; }; + +export const getPictureInPictureCallWindowOptions = (): Electron.BrowserWindowConstructorOptions => { + return getNewWindowOptions({ + title: 'Calling UI', + width: 290, + height: 290, + resizable: true, + fullscreenable: true, + maximizable: true, + }); +}; diff --git a/electron/src/main.ts b/electron/src/main.ts index 6d4e200e299..7909920cf0e 100644 --- a/electron/src/main.ts +++ b/electron/src/main.ts @@ -45,7 +45,7 @@ import {LogFactory} from '@wireapp/commons'; import {WebAppEvents} from '@wireapp/webapp-events'; import * as ProxyAuth from './auth/ProxyAuth'; -import {isPictureInPictureCallWindow} from './calling/PictureInPictureCall'; +import {getPictureInPictureCallWindowOptions, isPictureInPictureCallWindow} from './calling/PictureInPictureCall'; import { attachTo as attachCertificateVerifyProcManagerTo, setCertificateVerifyProc, @@ -592,26 +592,14 @@ class ElectronWrapperInit { if (SingleSignOn.isSingleSignOnLoginWindow(details.frameName)) { return { action: 'allow', - overrideBrowserWindowOptions: WindowUtil.getNewWindowOptions({ - title: SingleSignOn.getWindowTitle(details.url), - parent: main, - width: 480, - height: 600, - }), + overrideBrowserWindowOptions: SingleSignOn.getSingleSignOnLoginWindowOptions(main, details.url), }; } if (isPictureInPictureCallWindow(details.frameName)) { return { action: 'allow', - overrideBrowserWindowOptions: WindowUtil.getNewWindowOptions({ - title: 'Calling UI', - width: 290, - height: 290, - resizable: true, - fullscreenable: true, - maximizable: true, - }), + overrideBrowserWindowOptions: getPictureInPictureCallWindowOptions(), }; } diff --git a/electron/src/sso/SingleSignOn.ts b/electron/src/sso/SingleSignOn.ts index 06aaeff0f27..9c9415efc81 100644 --- a/electron/src/sso/SingleSignOn.ts +++ b/electron/src/sso/SingleSignOn.ts @@ -193,6 +193,17 @@ export class SingleSignOn { // Ensure authenticity of the window from within the code public static isSingleSignOnLoginWindow = (frameName: string) => SingleSignOn.SINGLE_SIGN_ON_FRAME_NAME === frameName; + public static getSingleSignOnLoginWindowOptions = ( + parent: BrowserWindow, + origin: string, + ): Electron.BrowserWindowConstructorOptions => + WindowUtil.getNewWindowOptions({ + title: SingleSignOn.getWindowTitle(origin), + parent, + width: 480, + height: 600, + }); + // Returns an empty string if the origin is a Wire backend public static getWindowTitle = (origin: string): string => SingleSignOn.ALLOWED_BACKEND_ORIGINS.includes(origin) ? '' : origin;