Adds bitcoincash URL support

This commit is contained in:
Gustavo Maximiliano Cortez 2017-09-08 16:55:04 -03:00
commit 823814817d
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
8 changed files with 45 additions and 26 deletions

View file

@ -57,10 +57,10 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
// 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) {
if (pathData.indexOf(/^bitcoin[cash]*:/) != -1) {
$log.debug('Bitcoin URL found');
handleOpenURL({
url: pathData.substring(pathData.indexOf('bitcoin:'))
url: pathData.substring(pathData.indexOf(/^bitcoin[cash]*:/))
});
} else if (pathData.indexOf(appConfigService.name + '://') != -1) {
$log.debug(appConfigService.name + ' URL found');
@ -84,6 +84,7 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
if (navigator.registerProtocolHandler) {
$log.debug('Registering Browser handlers base:' + base);
navigator.registerProtocolHandler('bitcoin', url, 'Copay Bitcoin Handler');
navigator.registerProtocolHandler('web+bitcoincash', url, 'Copay Bitcoin Cash Handler');
navigator.registerProtocolHandler('web+copay', url, 'Copay Wallet Handler');
navigator.registerProtocolHandler('web+bitpay', url, 'BitPay Wallet Handler');
}