From a7d484c944f1a0cd9b59d5f5da3b01a2af399b9a Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Mon, 30 Jun 2014 18:41:17 -0300 Subject: [PATCH] basic URI handling --- index.html | 1 + js/routes.js | 1 - js/services/controllerUtils.js | 3 ++- js/services/uriHandler.js | 11 +++++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 js/services/uriHandler.js diff --git a/index.html b/index.html index 339e7e7ce..b86275c94 100644 --- a/index.html +++ b/index.html @@ -926,6 +926,7 @@ on supported browsers please check http://www.w + diff --git a/js/routes.js b/js/routes.js index a4218112c..599f48677 100644 --- a/js/routes.js +++ b/js/routes.js @@ -64,7 +64,6 @@ angular }) .run(function($rootScope, $location) { $rootScope.$on('$routeChangeStart', function(event, next, current) { - if (!util.supports.data) { $location.path('unsupported'); } else { diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 342b33cdf..bf2f387a7 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -2,7 +2,7 @@ var bitcore = require('bitcore'); angular.module('copayApp.services') - .factory('controllerUtils', function($rootScope, $sce, $location, notification, $timeout, Socket, video) { + .factory('controllerUtils', function($rootScope, $sce, $location, notification, $timeout, Socket, video, uriHandler) { var root = {}; root.getVideoMutedStatus = function(copayer) { @@ -64,6 +64,7 @@ angular.module('copayApp.services') }; root.setupRootVariables = function() { + uriHandler.register(); $rootScope.unitName = config.unitName; $rootScope.txAlertCount = 0; $rootScope.insightError = 0; diff --git a/js/services/uriHandler.js b/js/services/uriHandler.js new file mode 100644 index 000000000..564bfb5a8 --- /dev/null +++ b/js/services/uriHandler.js @@ -0,0 +1,11 @@ +'use strict'; + +var UriHandler = function() {}; + +UriHandler.prototype.register = function() { + navigator.registerProtocolHandler('bitcoin', + 'uri=%s', + 'Copay'); +}; + +angular.module('copayApp.services').value('uriHandler', new UriHandler());