Merge branch 'master' into SDA-2533-Add-Annotate-To-Screenshot

This commit is contained in:
psjostrom 2020-11-17 09:26:06 +01:00 committed by GitHub
commit 794334ef90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 11 deletions

View File

@ -150,7 +150,7 @@ class Script
// these when running the installer, but if not specified, the defaults will be used.
project.Properties = new[]
{
new PublicProperty("ALLUSERS", "true"),
new PublicProperty("ALLUSERS", "1"),
new PublicProperty("ALWAYS_ON_TOP", "DISABLED" ),
new PublicProperty("AUTO_LAUNCH_PATH", ""),
new PublicProperty("AUTO_START", "ENABLED"),
@ -252,6 +252,22 @@ class Script
{
try
{
// "ALLUSERS" will be set to "2" if installing through UI, so the "MSIINSTALLPERUSER" property can be used so the user can choose install scope
if (e.Session["ALLUSERS"] != "2" )
{
// If "ALLUSERS" is "1" or "", this is a quiet command line installation, and we need to set the right paths here, since the UI haven't
if (e.Session["ALLUSERS"] == "")
{
// Install for current user
e.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Programs\Symphony\" + e.ProductName);
}
else
{
// Install for all users
e.Session["INSTALLDIR"] = e.Session["PROGRAMSFOLDER"] + @"\Symphony\" + e.ProductName;
}
}
// Try to close all running symphony instances before installing
KillSymphonyProcesses();

View File

@ -44,6 +44,7 @@ jest.mock('../src/app/window-handler', () => {
createScreenSharingIndicatorWindow: jest.fn(),
isOnline: false,
updateVersionInfo: jest.fn(),
isMana: false,
},
};
});
@ -405,5 +406,15 @@ describe('main api handler', () => {
ipcMain.send(apiName.symphonyApi, value);
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);
});
});
});

View File

@ -201,7 +201,15 @@ ipcMain.on(apiName.symphonyApi, async (event: Electron.IpcMainEvent, arg: IApiAr
if (windowHandler.appMenu) {
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:
break;
}
});

View File

@ -425,6 +425,8 @@ export class WindowHandler {
});
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!`);
// early exit if the window has already been destroyed
if (!this.mainWindow || !windowExists(this.mainWindow)) {
@ -435,13 +437,6 @@ export class WindowHandler {
}
this.url = this.mainWindow.webContents.getURL();
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
await injectStyles(this.mainWindow, this.isCustomTitleBar);

View File

@ -669,9 +669,7 @@ export const monitorNetworkInterception = (url: string) => {
if (!mainWindow || !windowExists(mainWindow)) {
return;
}
const manaUrl: string = await mainWindow.webContents.executeJavaScript('document.location.href');
const isMana = manaUrl && manaUrl.includes('client-bff');
if (!isMana && windowHandler.isWebPageLoading
if (!windowHandler.isMana && windowHandler.isWebPageLoading
&& (details.error === 'net::ERR_INTERNET_DISCONNECTED'
|| details.error === 'net::ERR_NETWORK_CHANGED'
|| details.error === 'net::ERR_NAME_NOT_RESOLVED')) {

View File

@ -43,6 +43,7 @@ export enum apiCmds {
showDownloadedItem = 'show-downloaded-item',
clearDownloadedItems = 'clear-downloaded-items',
restartApp = 'restart-app',
setIsMana = 'set-is-mana',
}
export enum apiName {
@ -78,6 +79,7 @@ export interface IApiArgs {
logName: string;
logs: ILogs;
cloudConfig: object;
isMana: boolean;
}
export type WindowTypes = 'screen-picker' | 'screen-sharing-indicator' | 'notification-settings';

View File

@ -51,6 +51,7 @@ createAPI();
if (ssfWindow.ssf) {
// New context bridge api that exposes all the methods on to window object
contextBridge.exposeInMainWorld('manaSSF', {
setIsMana: ssfWindow.ssf.setIsMana,
CryptoLib: ssfWindow.ssf.CryptoLib,
Search: ssfWindow.ssf.Search,
Notification: ssfWindow.ssf.Notification,

View File

@ -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,
});
}
}
/**