diff --git a/src/app/main.ts b/src/app/main.ts index fd39e342..e3f5d4f7 100644 --- a/src/app/main.ts +++ b/src/app/main.ts @@ -14,7 +14,10 @@ import { handlePerformanceSettings } from './perf-handler'; import { protocolHandler } from './protocol-handler'; import { ICustomBrowserWindow, windowHandler } from './window-handler'; +logger.info(`App started with the args ${JSON.stringify(process.argv)}`); + const allowMultiInstance: string | boolean = getCommandLineArgs(process.argv, '--multiInstance', true) || isDevEnv; +let isAppAlreadyOpen: boolean = false; handlePerformanceSettings(); setChromeFlags(); @@ -74,7 +77,8 @@ if (!allowMultiInstance) { mainWindow.restore(); } mainWindow.focus(); - protocolHandler.processArgv(argv); + isAppAlreadyOpen = true; + protocolHandler.processArgv(argv, isAppAlreadyOpen); } }); startApplication(); diff --git a/src/app/protocol-handler.ts b/src/app/protocol-handler.ts index 1a0baed9..5d1609f9 100644 --- a/src/app/protocol-handler.ts +++ b/src/app/protocol-handler.ts @@ -64,12 +64,12 @@ class ProtocolHandler { * * @param argv {String[]} - data received from process.argv */ - public processArgv(argv?: string[]): void { + public processArgv(argv?: string[], isAppAlreadyOpen: boolean = false): void { logger.info(`protocol handler: processing protocol args!`); const protocolUriFromArgv = getCommandLineArgs(argv || process.argv, protocol.SymphonyProtocol, false); if (protocolUriFromArgv) { logger.info(`protocol handler: we have a protocol request for the url ${protocolUriFromArgv}!`); - this.sendProtocol(protocolUriFromArgv, false); + this.sendProtocol(protocolUriFromArgv, isAppAlreadyOpen); } } }