diff --git a/public/views/uri.html b/old/uri.html similarity index 100% rename from public/views/uri.html rename to old/uri.html diff --git a/src/js/controllers/uri.js b/old/uri.js similarity index 100% rename from src/js/controllers/uri.js rename to old/uri.js diff --git a/src/js/routes.js b/src/js/routes.js index 04b4d043a..42c1e54b3 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -110,7 +110,14 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr .state('uri', { url: '/uri/:url', - templateUrl: 'views/uri.html' + controller: function($stateParams, $log, openURLService, profileService) { + profileService.whenAvailable(function() { + $log.info('DEEP LINK from Browser:' + $stateParams.url); + openURLService.handleURL({ + url: $stateParams.url + }); + }) + } }) .state('uripayment', { url: '/uri-payment/:url', @@ -653,7 +660,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }); }) - .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog) { + .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService) { if (platformInfo.isCordova) { if (screen.width < 768) { @@ -678,6 +685,9 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } } + uxLanguage.init(); + openURLService.init(); + $ionicPlatform.ready(function() { if (platformInfo.isCordova) { @@ -758,11 +768,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr $state.transitionTo('tabs.home'); } }); - - - }); - - uxLanguage.init(); + }); if (platformInfo.isNW) { var gui = require('nw.gui'); diff --git a/src/js/services/openURL.js b/src/js/services/openURL.js index a384214f3..1eb6d1c8f 100644 --- a/src/js/services/openURL.js +++ b/src/js/services/openURL.js @@ -1,18 +1,10 @@ 'use strict'; -angular.module('copayApp.services').factory('openURLService', function($rootScope, $ionicHistory, $document, $log, $state, go, platformInfo, lodash, profileService, incomingData) { +angular.module('copayApp.services').factory('openURLService', function($rootScope, $ionicHistory, $document, $log, $state, platformInfo, lodash, profileService, incomingData) { var root = {}; var handleOpenURL = function(args) { $log.info('Handling Open URL: ' + JSON.stringify(args)); - - profileService.whenAvailable(function() { - // Wait ux to settle - setTimeout(function() { - handleOpenURL(args); - }, 2000); - }); - // Stop it from caching the first view as one to return when the app opens $ionicHistory.nextViewOptions({ historyRoot: true, @@ -84,7 +76,6 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop }); } } else if (platformInfo.isDevel) { - var base = window.location.origin + '/'; var url = base + '#/uri/%s'; @@ -101,7 +92,14 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop root.registeredUriHandlers.push(x); }; - root.handleURL = handleOpenURL; + root.handleURL = function(args) { + profileService.whenAvailable(function() { + // Wait ux to settle + setTimeout(function() { + handleOpenURL(args); + }, 1000); + }); + }; - return root; +return root; });