highlight recent TXs

This commit is contained in:
Matias Alejo Garcia 2016-02-23 13:19:37 -03:00
commit 632e297a9f
2 changed files with 16 additions and 9 deletions

View file

@ -220,8 +220,8 @@
</div>
</div>
<div class="large-5 medium-5 small-5 columns text-right">
<span class="size-16">
<div class="large-5 medium-5 small-5 columns text-right" >
<span class="size-16" ng-class="{'text-bold': btx.recent}">
<span ng-if="btx.action == 'received'">+</span>
<span ng-if="btx.action == 'sent'">-</span>
<span class="size-12" ng-if="btx.action == 'invalid'" translate>

View file

@ -373,7 +373,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setSpendUnconfirmed = function(spendUnconfirmed) {
self.spendUnconfirmed = spendUnconfirmed || configService.getSync().wallet.spendUnconfirmed;
};
};
self.updateBalance = function() {
var fc = profileService.focusedClient;
@ -778,10 +778,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
self.removeSoftConfirmedTx = function(txs) {
self.removeAndMarkSoftConfirmedTx = function(txs) {
return lodash.filter(txs, function(tx) {
if (tx.confirmations >= SOFT_CONFIRMATION_LIMIT)
return tx;
tx.recent = true;
});
}
@ -835,7 +836,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
fixTxsUnit(txsFromLocal);
var confirmedTxs = self.removeSoftConfirmedTx(txsFromLocal);
var confirmedTxs = self.removeAndMarkSoftConfirmedTx(txsFromLocal);
var endingTxid = confirmedTxs[0] ? confirmedTxs[0].txid : null;
@ -845,9 +846,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setCompactTxHistory();
}
if (historyUpdateInProgress[walletId])
if (historyUpdateInProgress[walletId])
return;
historyUpdateInProgress[walletId] = true;
function getNewTxs(newTxs, skip, i_cb) {
@ -861,7 +862,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (!shouldContinue) {
newTxs = self.processNewTxs(newTxs);
$log.debug('Finish Sync: New Txs: ' + newTxs.length);
$log.debug('Finished Sync: New / soft confirmed Txs: ' + newTxs.length);
return i_cb(null, newTxs);
}
@ -889,6 +890,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (err) return cb(err);
var newHistory = lodash.compact(txs.concat(confirmedTxs));
var historyToSave = JSON.stringify(newHistory);
lodash.each(txs, function(tx) {
tx.recent = true;
})
$log.debug('Tx History synced. Total Txs: ' + newHistory.length);
// Final update
@ -897,7 +904,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setCompactTxHistory();
}
return storageService.setTxHistory(JSON.stringify(newHistory), walletId, function() {
return storageService.setTxHistory(historyToSave, walletId, function() {
$log.debug('Tx History saved.');
return cb();