Merge pull request #4614 from cmgustavo/feat/url-handler-windows

Adds bitcoin/copay URL handler support for Windows
This commit is contained in:
Matias Alejo Garcia 2016-07-28 17:36:38 -03:00 committed by GitHub
commit 6624827349
3 changed files with 141 additions and 94 deletions

View file

@ -90,6 +90,31 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
handleOpenURL(request.url);
}
});
} else if (platformInfo.isNW) {
var gui = require('nw.gui');
// This event is sent to an existent instance of Copay (only for standalone apps)
gui.App.on('open', function(pathData) {
if (pathData.indexOf('bitcoin:') != -1) {
$log.debug('Bitcoin URL found');
handleOpenURL({
url: pathData.substring(pathData.indexOf('bitcoin:'))
});
} else if (pathData.indexOf('copay:') != -1) {
$log.debug('Copay URL found');
handleOpenURL({
url: pathData.substring(pathData.indexOf('copay:'))
});
}
});
// Used at the startup of Copay
var argv = gui.App.argv;
if (argv && argv[0]) {
handleOpenURL({
url: argv[0]
});
}
} else if (platformInfo.isDevel) {
var base = window.location.origin + '/';