added bitcoin and bitcoin cash aliases to config and use them everywhere

This commit is contained in:
Kadir Sekha 2017-11-01 16:26:42 +09:00
commit a730c8e2d2
9 changed files with 41 additions and 12 deletions

View file

@ -180,6 +180,8 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.updateTxHistoryError = true;
return;
}
applyCurrencyAliases(txHistory);
$scope.completeTxHistory = txHistory;
$scope.showHistory();
$timeout(function() {
@ -190,6 +192,19 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
});
};
function applyCurrencyAliases(txHistory) {
var defaults = configService.getDefaults();
var configCache = configService.getSync();
lodash.each(txHistory, function(t) {
t.amountUnitStr = $scope.wallet.coin == 'btc'
? (configCache.bitcoinAlias || defaults.bitcoinAlias)
: (configCache.bitcoinCashAlias || defaults.bitcoinCashAlias);
t.amountUnitStr = t.amountUnitStr.toUpperCase();
});
}
$scope.showHistory = function() {
if ($scope.completeTxHistory) {
$scope.txHistory = $scope.completeTxHistory.slice(0, (currentTxHistoryPage + 1) * HISTORY_SHOW_LIMIT);