fix delay of submit after enter the PIN

This commit is contained in:
Gustavo Maximiliano Cortez 2014-12-11 18:13:13 -03:00
commit d4a4fe0498
7 changed files with 35 additions and 43 deletions

View file

@ -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)