Merge pull request #3909 from matiu/feat/highlight-recent

highlight recent TXs
This commit is contained in:
Gustavo Maximiliano Cortez 2016-02-23 16:27:07 -03:00
commit d2f02ff7a9
2 changed files with 16 additions and 9 deletions

View file

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

View file

@ -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) { return lodash.filter(txs, function(tx) {
if (tx.confirmations >= SOFT_CONFIRMATION_LIMIT) if (tx.confirmations >= SOFT_CONFIRMATION_LIMIT)
return tx; return tx;
tx.recent = true;
}); });
} }
@ -835,7 +836,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
fixTxsUnit(txsFromLocal); fixTxsUnit(txsFromLocal);
var confirmedTxs = self.removeSoftConfirmedTx(txsFromLocal); var confirmedTxs = self.removeAndMarkSoftConfirmedTx(txsFromLocal);
var endingTxid = confirmedTxs[0] ? confirmedTxs[0].txid : null; var endingTxid = confirmedTxs[0] ? confirmedTxs[0].txid : null;
@ -861,7 +862,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (!shouldContinue) { if (!shouldContinue) {
newTxs = self.processNewTxs(newTxs); 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); return i_cb(null, newTxs);
} }
@ -889,6 +890,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (err) return cb(err); if (err) return cb(err);
var newHistory = lodash.compact(txs.concat(confirmedTxs)); 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); $log.debug('Tx History synced. Total Txs: ' + newHistory.length);
// Final update // Final update
@ -897,7 +904,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setCompactTxHistory(); self.setCompactTxHistory();
} }
return storageService.setTxHistory(JSON.stringify(newHistory), walletId, function() { return storageService.setTxHistory(historyToSave, walletId, function() {
$log.debug('Tx History saved.'); $log.debug('Tx History saved.');
return cb(); return cb();