fix: ELECTRON-1345: fix protocol handler action issues (#702)

* ELECTRON-1345: fix processing protocol action

* ELECTRON-1354: add logs for process args
This commit is contained in:
Vishwas Shashidhar 2019-07-05 23:37:14 +05:30 committed by GitHub
parent 60d5a0cdde
commit 494b886045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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();

View File

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