diff --git a/js/controllers/createProfile.js b/js/controllers/createProfile.js index aec2acdbd..07205603f 100644 --- a/js/controllers/createProfile.js +++ b/js/controllers/createProfile.js @@ -43,7 +43,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun preconditions.checkArgument(pin); preconditions.checkState($rootScope.iden); preconditions.checkState(_credentials && _credentials.email); - $scope.loading = true; + $rootScope.starting = true; $timeout(function() { $rootScope.$digest(); @@ -53,10 +53,10 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun _credentials = null; $scope.askForPin = 0; $rootScope.hasPin = true; - $scope.loading = null; + $rootScope.starting = null; $scope.createDefaultWallet(); }); - }, 1); + }, 100); }; @@ -91,13 +91,10 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun }, 1); }; - - $scope.createDefaultWallet = function() { $rootScope.hideNavigation = false; identityService.createDefaultWallet(function(err) { $scope.askForPin = 0; - $scope.loading = false; if (err) { var msg = err.toString(); @@ -106,16 +103,15 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun }); }; - $scope._doCreateProfile = function(emailOrUsername, password, cb) { preconditions.checkArgument(_.isString(emailOrUsername)); preconditions.checkArgument(_.isString(password)); $rootScope.hideNavigation = false; - $scope.loading = true; + $rootScope.starting = true; identityService.create(emailOrUsername, password, function(err) { - $scope.loading = null; + $rootScope.starting = null; $scope.error = null; if (err) { var msg = err.toString(); diff --git a/js/controllers/home.js b/js/controllers/home.js index 4f2ec5522..7639a43e8 100644 --- a/js/controllers/home.js +++ b/js/controllers/home.js @@ -62,22 +62,19 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc return; } $rootScope.starting = true; - + $timeout(function() { - $rootScope.$digest(); var credentials = pinService.get(pin, function(err, credentials) { if (err || !credentials) { - $rootScope.starting = false; - $scope.loading = null; + $rootScope.starting = null; $scope.error = 'Wrong PIN'; return; } $scope.open(credentials.email, credentials.password); }); - },1); + },100); }; - $scope.openWallets = function() { preconditions.checkState($rootScope.iden); var iden = $rootScope.iden; @@ -90,16 +87,18 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc preconditions.checkArgument(pin); preconditions.checkState($rootScope.iden); preconditions.checkState(_credentials && _credentials.email); - $scope.loading = true; + $rootScope.starting = true; - pinService.save(pin, _credentials.email, _credentials.password, function(err) { - _credentials.password = ''; - _credentials = null; - $scope.askForPin = 0; - $rootScope.hasPin = true; - $scope.loading = null; - $scope.openWallets(); - }); + $timeout(function() { + pinService.save(pin, _credentials.email, _credentials.password, function(err) { + _credentials.password = ''; + _credentials = null; + $scope.askForPin = 0; + $rootScope.hasPin = true; + $rootScope.starting = null; + $scope.openWallets(); + }); + },100); }; $scope.openWithCredentials = function(form) { @@ -144,7 +143,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc $scope.error = 'Unknown error'; } $rootScope.starting = false; - $scope.loading = null; $timeout(function(){ $rootScope.$digest(); },1) diff --git a/views/createProfile.html b/views/createProfile.html index f563527ee..7503a48e9 100644 --- a/views/createProfile.html +++ b/views/createProfile.html @@ -1,9 +1,9 @@