fix url handling on cold start

This commit is contained in:
Matias Alejo Garcia 2016-06-11 23:08:30 -03:00
commit 27e925b84f
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
3 changed files with 12 additions and 9 deletions

View file

@ -518,7 +518,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} }
}); });
}) })
.run(function($rootScope, $state, $location, $log, $timeout, $ionicPlatform, platformInfo, profileService, uxLanguage, animationService, go, gettextCatalog) { .run(function($rootScope, $state, $location, $log, $timeout, $ionicPlatform, platformInfo, profileService, uxLanguage, go, gettextCatalog) {
$ionicPlatform.ready(function() { $ionicPlatform.ready(function() {
if (platformInfo.isCordova) { if (platformInfo.isCordova) {

View file

@ -24,9 +24,12 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
if (!profileService.isBound) { if (!profileService.isBound) {
$log.warn('Profile not bound yet. Waiting'); $log.warn('Profile not bound yet. Waiting');
return $rootScope.$on('Local/ProfileBound', function(){ return $rootScope.$on('Local/ProfileBound', function() {
$log.warn('Profile ready, retrying...'); // Wait ux to settle
handleOpenURL(args); setTimeout(function() {
$log.warn('Profile ready, retrying...');
handleOpenURL(args);
}, 2000);
}); });
}; };
@ -54,9 +57,9 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
var x = lodash.find(root.registeredUriHandlers, function(x) { var x = lodash.find(root.registeredUriHandlers, function(x) {
return url.indexOf(x.startsWith) == 0 || return url.indexOf(x.startsWith) == 0 ||
url.indexOf('web+' + x.startsWith) == 0 || // web protocols url.indexOf('web+' + x.startsWith) == 0 || // web protocols
url.indexOf(x.startsWith.replace(':','://')) == 0 // from mobile devices url.indexOf(x.startsWith.replace(':', '://')) == 0 // from mobile devices
; ;
}); });
if (x) { if (x) {

View file

@ -171,7 +171,7 @@ angular.module('copayApp.services')
} }
root.isBound = true; root.isBound = true;
$root.$emit('Local/ProfileBound'); $rootScope.$emit('Local/ProfileBound');
return cb(); return cb();
}); });
}); });