mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SDA-1268 - Workaround to exit fullscreen when notification is clicked (#939)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { app, ipcMain } from 'electron';
|
||||
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
|
||||
import { config } from '../app/config-handler';
|
||||
import { createComponentWindow, windowExists } from '../app/window-utils';
|
||||
@@ -242,6 +242,7 @@ class Notification extends NotificationHandler {
|
||||
callback(NotificationActions.notificationClicked, data);
|
||||
}
|
||||
this.hideNotification(clientId);
|
||||
this.exitFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,6 +330,23 @@ class Notification extends NotificationHandler {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* SDA-1268 - Workaround to exit window
|
||||
* fullscreen state when notification is clicked
|
||||
*/
|
||||
public exitFullScreen(): void {
|
||||
const browserWindows: ICustomBrowserWindow[] = BrowserWindow.getAllWindows() as ICustomBrowserWindow[];
|
||||
for (const win in browserWindows) {
|
||||
if (Object.prototype.hasOwnProperty.call(browserWindows, win)) {
|
||||
const browserWin = browserWindows[ win ];
|
||||
if (browserWin && windowExists(browserWin) && browserWin.winName === apiName.mainWindowName && browserWin.isFullScreen()) {
|
||||
browserWin.webContents.send('exit-html-fullscreen');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for window to load and resolves
|
||||
*
|
||||
|
||||
@@ -140,3 +140,9 @@ ipcRenderer.on('show-banner', (_event, { show, bannerType, url }) => {
|
||||
ipcRenderer.on('initialize-memory-refresh', () => {
|
||||
monitorMemory(getRandomTime(minMemoryFetchInterval, maxMemoryFetchInterval));
|
||||
});
|
||||
|
||||
ipcRenderer.on('exit-html-fullscreen', async () => {
|
||||
if (document && typeof document.exitFullscreen === 'function') {
|
||||
await document.exitFullscreen();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user