SDA-3799 Avoid having multiple proxy basic auth modals open at the same time (#1503)

* SDA-3799 Avoid having multiple proxy basic auth modals open at the same time

* SDA-3799 Auth modal always on top on macOS only + removing transparency
This commit is contained in:
Salah Benmoussati 2022-10-12 19:40:40 +02:00 committed by GitHub
parent 2dbe0e997e
commit e5cce3029d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1571,17 +1571,20 @@ export class WindowHandler {
clearSettings,
callback,
): void {
if (this.basicAuthWindow && windowExists(this.basicAuthWindow)) {
this.basicAuthWindow.close();
}
const opts = this.getWindowOpts(
{
width: 360,
height: isMac ? 270 : 295,
alwaysOnTop: true,
alwaysOnTop: isMac,
skipTaskbar: true,
resizable: false,
show: false,
modal: true,
frame: false,
transparent: true,
fullscreenable: false,
acceptFirstMouse: true,
},
@ -1604,13 +1607,13 @@ export class WindowHandler {
isValidCredentials: isMultipleTries,
});
});
const closeBasicAuth = (_event, shouldClearSettings = true) => {
if (shouldClearSettings) {
clearSettings();
}
if (this.basicAuthWindow && windowExists(this.basicAuthWindow)) {
this.basicAuthWindow.close();
this.basicAuthWindow = null;
}
};
@ -1621,6 +1624,7 @@ export class WindowHandler {
};
this.basicAuthWindow.once('close', () => {
this.basicAuthWindow = null;
ipcMain.removeListener('basic-auth-closed', closeBasicAuth);
ipcMain.removeListener('basic-auth-login', login);
});