Merge pull request #4382 from matiu/ref/validation

Ref/validation
This commit is contained in:
Gustavo Maximiliano Cortez 2016-06-14 14:54:58 -03:00 committed by GitHub
commit 5f7b68d32f
4 changed files with 64 additions and 33 deletions

View file

@ -139,7 +139,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.isPrivKeyEncrypted = fc.isPrivKeyEncrypted();
self.externalSource = fc.getPrivKeyExternalSourceName();
self.account = fc.credentials.account;
self.incorrectDerivation = fc.incorrectDerivation;
self.incorrectDerivation = fc.keyDerivationOk === false;
if (self.externalSource == 'trezor')
self.account++;
@ -290,7 +290,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} else {
self.isSingleAddress = !!ret.wallet.singleAddress;
if (!opts.quiet)
ongoingProcess.set('scanning', ret.wallet.scanStatus == 'running');
self.updating = ret.wallet.scanStatus == 'running';
}
return cb(err, ret);
});
@ -1019,13 +1019,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (!c.isComplete()) return;
if (self.walletId == walletId)
ongoingProcess.set('scanning', true);
self.updating = true;
c.startScan({
includeCopayerBranches: true,
}, function(err) {
if (err && self.walletId == walletId) {
ongoingProcess.set('scanning', false);
self.updating = false;
self.handleError(err);
$rootScope.$apply();
}
@ -1392,6 +1392,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
self.isInFocus = function(walletId) {
var fc = profileService.focusedClient;
return fc && fc.credentials.walletId == walletId;
};
self.setAddressbook = function(ab) {
if (ab) {
self.addressbook = ab;
@ -1412,12 +1417,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.tab = 'walletHome';
});
$rootScope.$on('Local/ValidatingWallet', function() {
ongoingProcess.set('validatingWallet', true);
$rootScope.$on('Local/ValidatingWallet', function(ev, walletId) {
if (self.isInFocus(walletId)) {
ongoingProcess.set('validatingWallet', true);
}
});
$rootScope.$on('Local/ProfileBound', function() {
ongoingProcess.set('validatingWallet', false);
$rootScope.$on('Local/ValidatingWalletEnded', function(ev, walletId, isOK) {
if (self.isInFocus(walletId)) {
ongoingProcess.set('validatingWallet', false);
self.incorrectDerivation = isOK === false;
}
});
$rootScope.$on('Local/ClearHistory', function(event) {
@ -1479,8 +1489,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
$rootScope.$on('Local/WalletCompleted', function(event, walletId) {
var fc = profileService.focusedClient;
if (fc && fc.credentials.walletId == walletId) {
if (self.isInFocus(walletId)) {
// reset main wallet variables
self.setFocusedWallet();
go.walletHome();