mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-31 19:27:00 -06:00
SDA-1932: fix switching client based on focused window
Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>
This commit is contained in:
parent
dba424dd53
commit
6b9e68d72d
@ -1092,9 +1092,9 @@ export class WindowHandler {
|
|||||||
logger.info(`window handler: switch to client ${clientSwitch}`);
|
logger.info(`window handler: switch to client ${clientSwitch}`);
|
||||||
logger.info(`window handler: currentClient: ${this.currentClient}`);
|
logger.info(`window handler: currentClient: ${this.currentClient}`);
|
||||||
this.currentClient = clientSwitch;
|
this.currentClient = clientSwitch;
|
||||||
const focusedWindow = BrowserWindow.getFocusedWindow();
|
|
||||||
|
|
||||||
if (!(focusedWindow && windowExists(focusedWindow))) {
|
if (!this.mainWindow || !windowExists(this.mainWindow)) {
|
||||||
|
logger.info(`window-handler: switch client - main window web contents destroyed already! exiting`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -1104,7 +1104,7 @@ export class WindowHandler {
|
|||||||
const parsedUrl = parse(this.url);
|
const parsedUrl = parse(this.url);
|
||||||
const manaPath = 'client-bff';
|
const manaPath = 'client-bff';
|
||||||
const manaChannel = 'daily';
|
const manaChannel = 'daily';
|
||||||
const csrfToken = await focusedWindow.webContents.executeJavaScript(`localStorage.getItem('x-km-csrf-token')`);
|
const csrfToken = await this.mainWindow.webContents.executeJavaScript(`localStorage.getItem('x-km-csrf-token')`);
|
||||||
switch (this.currentClient) {
|
switch (this.currentClient) {
|
||||||
case ClientSwitchType.CLIENT_1_5:
|
case ClientSwitchType.CLIENT_1_5:
|
||||||
this.url = this.startUrl;
|
this.url = this.startUrl;
|
||||||
@ -1120,7 +1120,7 @@ export class WindowHandler {
|
|||||||
}
|
}
|
||||||
await config.updateUserConfig({ clientSwitch });
|
await config.updateUserConfig({ clientSwitch });
|
||||||
this.config.clientSwitch = clientSwitch;
|
this.config.clientSwitch = clientSwitch;
|
||||||
await focusedWindow.loadURL(this.url);
|
await this.mainWindow.loadURL(this.url);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`window-handler: failed to switch client because of error ${e}`);
|
logger.error(`window-handler: failed to switch client because of error ${e}`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user