ELECTRON-500 / ELECTRON-384: fix protocol handler non-window use case (#372)

- fix issue in protocol handler when app is not initialized
- fix formatting issues
This commit is contained in:
Vishwas Shashidhar
2018-05-21 13:27:53 +05:30
committed by GitHub
parent 8037d16000
commit c36b639296
2 changed files with 13 additions and 6 deletions

View File

@@ -364,17 +364,15 @@ function processProtocolAction(argv) {
}
let protocolUri = getCmdLineArg(argv, 'symphony://', false);
log.send(logLevels.INFO, `Trying to process a protocol action for uri ${protocolUri}`);
if (protocolUri) {
const parsedURL = urlParser.parse(protocolUri);
if (!parsedURL.protocol || !parsedURL.slashes) {
return;
}
log.send(logLevels.INFO, `Parsing protocol url successful for ${parsedURL}`);
handleProtocolAction(protocolUri);
}
}
@@ -384,10 +382,12 @@ function processProtocolAction(argv) {
*/
function handleProtocolAction(uri) {
if (!isAppAlreadyOpen) {
log.send(logLevels.INFO, `App started by protocol url ${uri}. We are caching this to be processed later!`);
// app is opened by the protocol url, cache the protocol url to be used later
protocolHandler.setProtocolUrl(uri);
} else {
// app is already open, so, just trigger the protocol action method
log.send(logLevels.INFO, `App opened by protocol url ${uri}`);
protocolHandler.processProtocolAction(uri);
}
}