fix delay of submit after enter the PIN
This commit is contained in:
parent
065b95293a
commit
d4a4fe0498
7 changed files with 35 additions and 43 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue