Skip to content

Commit

Permalink
SDA-3871 Closing screensharing frame and screen picker window after t…
Browse files Browse the repository at this point in the history
…he end of a meeting (#1501)
  • Loading branch information
sbenmoussati authored Sep 23, 2022
1 parent 52cae21 commit fc75ac6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/app/main-api-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ ipcMain.on(
if (typeof arg.isInMeeting === 'boolean') {
memoryMonitor.setMeetingStatus(arg.isInMeeting);
appStateHandler.preventDisplaySleep(arg.isInMeeting);
if (!arg.isInMeeting) {
windowHandler.closeScreenPickerWindow();
windowHandler.closeScreenSharingIndicator();
}
}
break;
case apiCmds.memoryInfo:
Expand Down
31 changes: 23 additions & 8 deletions src/app/window-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ export class WindowHandler {
`window-handler: main window closed, destroying all windows!`,
);
if (isWindowsOS || isMac) {
this.execCmd(this.screenShareIndicatorFrameUtil, []);
this.closeScreenSharingIndicator();
}
this.closeAllWindows();
this.destroyAllWindows();
Expand Down Expand Up @@ -921,10 +921,7 @@ export class WindowHandler {
}
if (isWindowsOS || isMac) {
const timeoutValue = 300;
setTimeout(
() => this.execCmd(this.screenShareIndicatorFrameUtil, []),
timeoutValue,
);
setTimeout(() => this.closeScreenSharingIndicator(), timeoutValue);
} else {
if (
this.screenSharingFrameWindow &&
Expand Down Expand Up @@ -1449,7 +1446,7 @@ export class WindowHandler {
if (source != null) {
logger.info(`window-handler: screen-source-select`, source, id);

this.execCmd(this.screenShareIndicatorFrameUtil, []);
this.closeScreenSharingIndicator();
const timeoutValue = 300;
setTimeout(() => {
this.drawScreenShareIndicatorFrame(source);
Expand All @@ -1470,7 +1467,7 @@ export class WindowHandler {
ipcMain.once('screen-source-selected', (_event, source) => {
logger.info(`window-handler: screen-source-selected`, source, id);
if (source == null) {
this.execCmd(this.screenShareIndicatorFrameUtil, []);
this.closeScreenSharingIndicator();
if (
this.screenPickerPlaceholderWindow &&
windowExists(this.screenPickerPlaceholderWindow)
Expand Down Expand Up @@ -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
* requires authentications
Expand Down Expand Up @@ -2092,7 +2107,7 @@ export class WindowHandler {
default:
this.url = this.globalConfig.url + `?x-km-csrf-token=${csrfToken}`;
}
await this.execCmd(this.screenShareIndicatorFrameUtil, []);
await this.closeScreenSharingIndicator();
const userAgent = this.getUserAgent(this.mainWebContents);
await this.mainWebContents.loadURL(this.url, { userAgent });
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/window-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const preventWindowNavigation = (
}
}

windowHandler.execCmd(windowHandler.screenShareIndicatorFrameUtil, []);
windowHandler.closeScreenSharingIndicator();
}

if (
Expand Down Expand Up @@ -773,7 +773,7 @@ export const reloadWindow = (browserWindow: ICustomBrowserWindow) => {

windowHandler.closeAllWindows();

windowHandler.execCmd(windowHandler.screenShareIndicatorFrameUtil, []);
windowHandler.closeScreenSharingIndicator();

return;
}
Expand Down

0 comments on commit fc75ac6

Please sign in to comment.