This commit is contained in:
Matias Alejo Garcia 2016-08-23 10:26:47 -03:00
commit 8bcb332276
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
3 changed files with 13 additions and 11 deletions

View file

@ -105,23 +105,20 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$log.debug('Updating wallet:'+ wallet.name) $log.debug('Updating wallet:'+ wallet.name)
walletService.getStatus(wallet, {}, function(err, status) { walletService.getStatus(wallet, {}, function(err, status) {
console.log('[tab-home.js.107:status:]',status); //TODO
if (err) { if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return; return;
} }
if (status.pendingTxps && status.pendingTxps[0]) { if (status.pendingTxps && status.pendingTxps[0]) {
console.log('[tab-home.js.113]', status.pendingTxps); //TODO
var txps = lodash.filter($scope.txps, function(x) { var txps = lodash.filter($scope.txps, function(x) {
return x.walletId != wallet.id; return x.walletId != wallet.id;
}); });
txps = txps.concat(status.pendingTxps); txps = txps.concat(status.pendingTxps);
txps = formatPendingTxps(txps); txps = formatPendingTxps(txps);
console.log('[tab-home.js.120:txps:]',txps); //TODO
setPendingTxps(txps); setPendingTxps(txps);
} }
wallet.status = status; wallet.status = status;
$scope.$apply();
}); });
}; };

View file

@ -71,8 +71,9 @@ angular.module('copayApp.services')
walletId, wallet.credentials.walletName); walletId, wallet.credentials.walletName);
if (wallet.cacheStatus) // TODO (put this in wallet ViewModel)
wallet.cacheStatus.isValid = false; if (wallet.cachedStatus)
wallet.cachedStatus.isValid = false;
if (wallet.completeHistory) if (wallet.completeHistory)
wallet.completeHistory.isValid = false; wallet.completeHistory.isValid = false;

View file

@ -114,12 +114,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.invalidateCache = function(wallet) { root.invalidateCache = function(wallet) {
if (wallet.cacheStatus) { if (wallet.cachedStatus) {
wallet.cacheStatus.isValid = false; wallet.cachedStatus.isValid = false;
} }
if (wallet.cacheHistory) { if (wallet.completeHistory) {
wallet.cacheHistory.isValid = false; wallet.completeHistory.isValid = false;
} }
}; };
@ -214,7 +214,11 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
}; };
function _getStatus(initStatusHash, tries, cb) { function _getStatus(initStatusHash, tries, cb) {
if (isStatusCached() && !opts.force) return cb(null, wallet.cachedStatus); if (isStatusCached() && !opts.force) {
$log.debug('Wallet status cache hit:' + wallet.id);
return cb(null, wallet.cachedStatus);
};
tries = tries || 0; tries = tries || 0;