Merge pull request #2519 from matiaspando/feat/scanStatus

Scanning addresses
This commit is contained in:
Matias Alejo Garcia 2015-04-15 14:12:55 -03:00
commit 7fa97ebc68
3 changed files with 27 additions and 22 deletions

View File

@ -8,6 +8,12 @@
</div>
<div ng-show="index.walletScanStatus == 'error' && !index.anyOnGoingProcess" ng-click='index.retryScan()'>
Scan status finished with error
<br> [Tap to retry]
</div>
<div class="size-36" ng-show="!index.anyOnGoingProcess">
<strong>

View File

@ -50,7 +50,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.isComplete = fc.isComplete();
self.txps = [];
self.copayers = [];
self.setOngoingProcess('scanning', fc.scanning);
self.lockedBalance = null;
self.totalBalanceStr = null;
self.notAuthorized = false;
@ -72,7 +71,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
else {
self.updateError = false;
return fc.getStatus(function(err, ret) {
if (err) self.updateError = true;
if (err) {
self.updateError = true;
} else {
self.setOngoingProcess('scanning', ret.wallet.scanning);
}
return cb(err, ret);
});
}
@ -97,6 +100,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.walletName = walletStatus.wallet.name;
self.walletSecret = walletStatus.wallet.secret;
self.walletStatus = walletStatus.wallet.status;
self.walletScanStatus = walletStatus.wallet.scanStatus;
self.copayers = walletStatus.wallet.copayers;
self.setBalance(walletStatus.balance);
});
@ -369,9 +373,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
go.swipe();
};
self.retryScan = function() {
var self = this;
self.startScan(self.walletId);
}
self.startScan = function(walletId) {
var c = profileService.walletClients[walletId];
c.scanning = true;
if (self.walletId == walletId)
self.setOngoingProcess('scanning', true);
@ -380,7 +388,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
includeCopayerBranches: true,
}, function(err) {
if (err) {
c.scanning = false;
if (self.walletId == walletId)
self.setOngoingProcess('scanning', false);
self.clientError = 'Could not scan wallet:' + err;
@ -467,22 +474,19 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.swipeRight = true;
});
lodash.each(['NewIncomingTx', 'ScanFinished'], function(eventName) {
$rootScope.$on(eventName, function() {
if (eventName == 'ScanFinished') {
self.setOngoingProcess('scanning', false);
}
self.updateBalance();
$timeout(function() {
self.updateTxHistory();
}, 5000);
});
$rootScope.$on('NewIncomingTx', function() {
self.updateBalance();
$timeout(function() {
self.updateTxHistory();
}, 5000);
});
// remove transactionProposalRemoved (only for compat)
lodash.each(['NewOutgoingTx', 'NewTxProposal', 'TxProposalFinallyRejected', 'transactionProposalRemoved', 'TxProposalRemoved',
'Local/NewTxProposal', 'Local/TxProposalAction'
'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished'
], function(eventName) {
$rootScope.$on(eventName, function() {
self.updateAll();

View File

@ -79,11 +79,6 @@ angular.module('copayApp.services')
notificationService.newBWCNotification(n,
client.credentials.walletId, client.credentials.walletName);
// Actions for both focuses and unfocuses wallets...
if (n.type == 'ScanFinished') {
client.scanning = false;
}
if (root.focusedClient.credentials.walletId == client.credentials.walletId) {
$rootScope.$emit(n.type);
} else {
@ -359,11 +354,11 @@ angular.module('copayApp.services')
return cb('Wrong password');
}
$timeout(function() {
if( fc.isPrivKeyEncrypted()) {
if (fc.isPrivKeyEncrypted()) {
$log.debug('Locking wallet automatically');
root.lockFC();
};
},2000);
}, 2000);
return cb();
});
};