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() {
if (platformInfo.isCordova) {

View file

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

View file

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