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

@ -220,8 +220,8 @@
</div> </div>
</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

@ -373,7 +373,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setSpendUnconfirmed = function(spendUnconfirmed) { self.setSpendUnconfirmed = function(spendUnconfirmed) {
self.spendUnconfirmed = spendUnconfirmed || configService.getSync().wallet.spendUnconfirmed; self.spendUnconfirmed = spendUnconfirmed || configService.getSync().wallet.spendUnconfirmed;
}; };
self.updateBalance = function() { self.updateBalance = function() {
var fc = profileService.focusedClient; 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) { 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;
@ -845,9 +846,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setCompactTxHistory(); self.setCompactTxHistory();
} }
if (historyUpdateInProgress[walletId]) if (historyUpdateInProgress[walletId])
return; return;
historyUpdateInProgress[walletId] = true; historyUpdateInProgress[walletId] = true;
function getNewTxs(newTxs, skip, i_cb) { function getNewTxs(newTxs, skip, i_cb) {
@ -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();