MM-49079 - Calls: process link clicks from Calls popout (#2558)

* process link clicks from Calls popout

* add a mock for windows tests
This commit is contained in:
Christopher Poile
2023-02-17 13:41:01 -05:00
committed by GitHub
parent 7127ec153a
commit ec8e0b9cc2
7 changed files with 70 additions and 8 deletions

View File

@@ -7,9 +7,7 @@ import path from 'path';
import {app, BrowserWindow, nativeImage, systemPreferences, ipcMain, IpcMainEvent, IpcMainInvokeEvent, desktopCapturer} from 'electron';
import log from 'electron-log';
import {
CallsJoinCallMessage,
} from 'types/calls';
import {CallsJoinCallMessage, CallsLinkClickMessage} from 'types/calls';
import {
MAXIMIZE_CHANGE,
@@ -35,6 +33,7 @@ import {
DESKTOP_SOURCES_MODAL_REQUEST,
CALLS_WIDGET_CHANNEL_LINK_CLICK,
CALLS_ERROR,
CALLS_LINK_CLICK,
} from 'common/communication';
import urlUtils from 'common/utils/url';
import {SECOND} from 'common/utils/constants';
@@ -95,6 +94,7 @@ export class WindowManager {
ipcMain.on(CALLS_LEAVE_CALL, () => this.callsWidgetWindow?.close());
ipcMain.on(DESKTOP_SOURCES_MODAL_REQUEST, this.handleDesktopSourcesModalRequest);
ipcMain.on(CALLS_WIDGET_CHANNEL_LINK_CLICK, this.handleCallsWidgetChannelLinkClick);
ipcMain.on(CALLS_LINK_CLICK, this.handleCallsLinkClick);
}
handleUpdateConfig = () => {
@@ -150,6 +150,13 @@ export class WindowManager {
}
}
handleCallsLinkClick = (_: IpcMainEvent, msg: CallsLinkClickMessage) => {
log.debug('WindowManager.handleCallsLinkClick with linkURL', msg.link);
this.mainWindow?.focus();
const currentView = this.viewManager?.getCurrentView();
currentView?.view.webContents.send(BROWSER_HISTORY_PUSH, msg.link);
}
showSettingsWindow = () => {
log.debug('WindowManager.showSettingsWindow');