mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-29 02:11:28 -06:00
Merge branch 'master' into SDA-2681
This commit is contained in:
commit
2f03d802b0
@ -44,6 +44,7 @@ jest.mock('../src/app/window-handler', () => {
|
|||||||
createScreenSharingIndicatorWindow: jest.fn(),
|
createScreenSharingIndicatorWindow: jest.fn(),
|
||||||
isOnline: false,
|
isOnline: false,
|
||||||
updateVersionInfo: jest.fn(),
|
updateVersionInfo: jest.fn(),
|
||||||
|
isMana: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -405,5 +406,15 @@ describe('main api handler', () => {
|
|||||||
ipcMain.send(apiName.symphonyApi, value);
|
ipcMain.send(apiName.symphonyApi, value);
|
||||||
expect(spy).toBeCalledWith(...expectedValue);
|
expect(spy).toBeCalledWith(...expectedValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should call `setIsMana` correctly', () => {
|
||||||
|
const value = {
|
||||||
|
cmd: apiCmds.setIsMana,
|
||||||
|
isMana: true,
|
||||||
|
};
|
||||||
|
expect(windowHandler.isMana).toBe(false);
|
||||||
|
ipcMain.send(apiName.symphonyApi, value);
|
||||||
|
expect(windowHandler.isMana).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -201,7 +201,15 @@ ipcMain.on(apiName.symphonyApi, async (event: Electron.IpcMainEvent, arg: IApiAr
|
|||||||
if (windowHandler.appMenu) {
|
if (windowHandler.appMenu) {
|
||||||
windowHandler.appMenu.buildMenu();
|
windowHandler.appMenu.buildMenu();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case apiCmds.setIsMana:
|
||||||
|
if (typeof arg.isMana === 'boolean') {
|
||||||
|
windowHandler.isMana = arg.isMana;
|
||||||
|
logger.info('window-handler: isMana: ' + windowHandler.isMana);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -425,6 +425,8 @@ export class WindowHandler {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.mainWindow.webContents.on('did-finish-load', async () => {
|
this.mainWindow.webContents.on('did-finish-load', async () => {
|
||||||
|
// reset to false when the client reloads
|
||||||
|
this.isMana = false;
|
||||||
logger.info(`window-handler: main window web contents finished loading!`);
|
logger.info(`window-handler: main window web contents finished loading!`);
|
||||||
// early exit if the window has already been destroyed
|
// early exit if the window has already been destroyed
|
||||||
if (!this.mainWindow || !windowExists(this.mainWindow)) {
|
if (!this.mainWindow || !windowExists(this.mainWindow)) {
|
||||||
@ -435,13 +437,6 @@ export class WindowHandler {
|
|||||||
}
|
}
|
||||||
this.url = this.mainWindow.webContents.getURL();
|
this.url = this.mainWindow.webContents.getURL();
|
||||||
logger.info('window-handler: did-finish-load, url: ' + this.url);
|
logger.info('window-handler: did-finish-load, url: ' + this.url);
|
||||||
const manaPath = 'client-bff';
|
|
||||||
if (this.url.includes(manaPath)) {
|
|
||||||
this.isMana = true;
|
|
||||||
} else {
|
|
||||||
this.isMana = false;
|
|
||||||
}
|
|
||||||
logger.info('window-handler: isMana: ' + this.isMana);
|
|
||||||
|
|
||||||
// Injects custom title bar and snack bar css into the webContents
|
// Injects custom title bar and snack bar css into the webContents
|
||||||
await injectStyles(this.mainWindow, this.isCustomTitleBar);
|
await injectStyles(this.mainWindow, this.isCustomTitleBar);
|
||||||
|
@ -669,9 +669,7 @@ export const monitorNetworkInterception = (url: string) => {
|
|||||||
if (!mainWindow || !windowExists(mainWindow)) {
|
if (!mainWindow || !windowExists(mainWindow)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const manaUrl: string = await mainWindow.webContents.executeJavaScript('document.location.href');
|
if (!windowHandler.isMana && windowHandler.isWebPageLoading
|
||||||
const isMana = manaUrl && manaUrl.includes('client-bff');
|
|
||||||
if (!isMana && windowHandler.isWebPageLoading
|
|
||||||
&& (details.error === 'net::ERR_INTERNET_DISCONNECTED'
|
&& (details.error === 'net::ERR_INTERNET_DISCONNECTED'
|
||||||
|| details.error === 'net::ERR_NETWORK_CHANGED'
|
|| details.error === 'net::ERR_NETWORK_CHANGED'
|
||||||
|| details.error === 'net::ERR_NAME_NOT_RESOLVED')) {
|
|| details.error === 'net::ERR_NAME_NOT_RESOLVED')) {
|
||||||
|
@ -43,6 +43,7 @@ export enum apiCmds {
|
|||||||
showDownloadedItem = 'show-downloaded-item',
|
showDownloadedItem = 'show-downloaded-item',
|
||||||
clearDownloadedItems = 'clear-downloaded-items',
|
clearDownloadedItems = 'clear-downloaded-items',
|
||||||
restartApp = 'restart-app',
|
restartApp = 'restart-app',
|
||||||
|
setIsMana = 'set-is-mana',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum apiName {
|
export enum apiName {
|
||||||
@ -78,6 +79,7 @@ export interface IApiArgs {
|
|||||||
logName: string;
|
logName: string;
|
||||||
logs: ILogs;
|
logs: ILogs;
|
||||||
cloudConfig: object;
|
cloudConfig: object;
|
||||||
|
isMana: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type WindowTypes = 'screen-picker' | 'screen-sharing-indicator' | 'notification-settings';
|
export type WindowTypes = 'screen-picker' | 'screen-sharing-indicator' | 'notification-settings';
|
||||||
|
@ -51,6 +51,7 @@ createAPI();
|
|||||||
if (ssfWindow.ssf) {
|
if (ssfWindow.ssf) {
|
||||||
// New context bridge api that exposes all the methods on to window object
|
// New context bridge api that exposes all the methods on to window object
|
||||||
contextBridge.exposeInMainWorld('manaSSF', {
|
contextBridge.exposeInMainWorld('manaSSF', {
|
||||||
|
setIsMana: ssfWindow.ssf.setIsMana,
|
||||||
CryptoLib: ssfWindow.ssf.CryptoLib,
|
CryptoLib: ssfWindow.ssf.CryptoLib,
|
||||||
Search: ssfWindow.ssf.Search,
|
Search: ssfWindow.ssf.Search,
|
||||||
Notification: ssfWindow.ssf.Notification,
|
Notification: ssfWindow.ssf.Notification,
|
||||||
|
@ -579,6 +579,17 @@ export class SSFApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the client is running on mana
|
||||||
|
* @param isMana
|
||||||
|
*/
|
||||||
|
public setIsMana(isMana: boolean): void {
|
||||||
|
ipcRenderer.send(apiName.symphonyApi, {
|
||||||
|
cmd: apiCmds.setIsMana,
|
||||||
|
isMana,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user