SDA-3871 Closing screensharing frame and screen picker window after the end of a meeting (#1501)

This commit is contained in:
Salah Benmoussati 2022-09-23 11:22:57 +02:00 committed by GitHub
parent 52cae21865
commit fc75ac60a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 10 deletions

View File

@ -248,6 +248,10 @@ ipcMain.on(
if (typeof arg.isInMeeting === 'boolean') { if (typeof arg.isInMeeting === 'boolean') {
memoryMonitor.setMeetingStatus(arg.isInMeeting); memoryMonitor.setMeetingStatus(arg.isInMeeting);
appStateHandler.preventDisplaySleep(arg.isInMeeting); appStateHandler.preventDisplaySleep(arg.isInMeeting);
if (!arg.isInMeeting) {
windowHandler.closeScreenPickerWindow();
windowHandler.closeScreenSharingIndicator();
}
} }
break; break;
case apiCmds.memoryInfo: case apiCmds.memoryInfo:

View File

@ -652,7 +652,7 @@ export class WindowHandler {
`window-handler: main window closed, destroying all windows!`, `window-handler: main window closed, destroying all windows!`,
); );
if (isWindowsOS || isMac) { if (isWindowsOS || isMac) {
this.execCmd(this.screenShareIndicatorFrameUtil, []); this.closeScreenSharingIndicator();
} }
this.closeAllWindows(); this.closeAllWindows();
this.destroyAllWindows(); this.destroyAllWindows();
@ -921,10 +921,7 @@ export class WindowHandler {
} }
if (isWindowsOS || isMac) { if (isWindowsOS || isMac) {
const timeoutValue = 300; const timeoutValue = 300;
setTimeout( setTimeout(() => this.closeScreenSharingIndicator(), timeoutValue);
() => this.execCmd(this.screenShareIndicatorFrameUtil, []),
timeoutValue,
);
} else { } else {
if ( if (
this.screenSharingFrameWindow && this.screenSharingFrameWindow &&
@ -1449,7 +1446,7 @@ export class WindowHandler {
if (source != null) { if (source != null) {
logger.info(`window-handler: screen-source-select`, source, id); logger.info(`window-handler: screen-source-select`, source, id);
this.execCmd(this.screenShareIndicatorFrameUtil, []); this.closeScreenSharingIndicator();
const timeoutValue = 300; const timeoutValue = 300;
setTimeout(() => { setTimeout(() => {
this.drawScreenShareIndicatorFrame(source); this.drawScreenShareIndicatorFrame(source);
@ -1470,7 +1467,7 @@ export class WindowHandler {
ipcMain.once('screen-source-selected', (_event, source) => { ipcMain.once('screen-source-selected', (_event, source) => {
logger.info(`window-handler: screen-source-selected`, source, id); logger.info(`window-handler: screen-source-selected`, source, id);
if (source == null) { if (source == null) {
this.execCmd(this.screenShareIndicatorFrameUtil, []); this.closeScreenSharingIndicator();
if ( if (
this.screenPickerPlaceholderWindow && this.screenPickerPlaceholderWindow &&
windowExists(this.screenPickerPlaceholderWindow) windowExists(this.screenPickerPlaceholderWindow)
@ -1519,6 +1516,24 @@ export class WindowHandler {
}); });
} }
/**
* Closes a screen picker window if it exists
*
*/
public closeScreenPickerWindow() {
if (this.screenPickerWindow && windowExists(this.screenPickerWindow)) {
this.screenPickerWindow.close();
}
}
/**
* Closes screen sharing indicator
*
*/
public async closeScreenSharingIndicator() {
this.execCmd(this.screenShareIndicatorFrameUtil, []);
}
/** /**
* Creates a Basic auth window whenever the network * Creates a Basic auth window whenever the network
* requires authentications * requires authentications
@ -2092,7 +2107,7 @@ export class WindowHandler {
default: default:
this.url = this.globalConfig.url + `?x-km-csrf-token=${csrfToken}`; this.url = this.globalConfig.url + `?x-km-csrf-token=${csrfToken}`;
} }
await this.execCmd(this.screenShareIndicatorFrameUtil, []); await this.closeScreenSharingIndicator();
const userAgent = this.getUserAgent(this.mainWebContents); const userAgent = this.getUserAgent(this.mainWebContents);
await this.mainWebContents.loadURL(this.url, { userAgent }); await this.mainWebContents.loadURL(this.url, { userAgent });
} catch (e) { } catch (e) {

View File

@ -154,7 +154,7 @@ export const preventWindowNavigation = (
} }
} }
windowHandler.execCmd(windowHandler.screenShareIndicatorFrameUtil, []); windowHandler.closeScreenSharingIndicator();
} }
if ( if (
@ -773,7 +773,7 @@ export const reloadWindow = (browserWindow: ICustomBrowserWindow) => {
windowHandler.closeAllWindows(); windowHandler.closeAllWindows();
windowHandler.execCmd(windowHandler.screenShareIndicatorFrameUtil, []); windowHandler.closeScreenSharingIndicator();
return; return;
} }