diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js
index d96483aab..b754ba22b 100644
--- a/src/js/controllers/amount.js
+++ b/src/js/controllers/amount.js
@@ -27,7 +27,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
var config = configService.getSync().wallet.settings;
function setAvailableUnits() {
-
+ var defaults = configService.getDefaults();
+ var configCache = configService.getSync();
availableUnits = [];
var hasBTCWallets = profileService.getWallets({
@@ -38,22 +39,19 @@ angular.module('copayApp.controllers').controller('amountController', function($
availableUnits.push({
name: 'Bitcoin',
id: 'btc',
- shortName: 'BTC',
+ shortName: (configCache.bitcoinAlias || defaults.bitcoinAlias).toUpperCase(),
});
}
-
var hasBCHWallets = profileService.getWallets({
coin: 'bch'
}).length;
-
-
if (hasBCHWallets) {
availableUnits.push({
name: 'Bitcoin Cash',
id: 'bch',
- shortName: 'BCH',
+ shortName: (configCache.bitcoinCashAlias || defaults.bitcoinCashAlias).toUpperCase(),
});
};
@@ -310,7 +308,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
$scope.alternativeAmount = txFormatService.formatAmount(a * unitToSatoshi, true);
} else {
if (result) {
- $scope.alternativeAmount = 'N/A';
+ $scope.alternativeAmount = 'N/A';
} else {
$scope.alternativeAmount = null;
}
diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js
index 92efa36d6..b11906fea 100644
--- a/src/js/controllers/create.js
+++ b/src/js/controllers/create.js
@@ -24,12 +24,15 @@ angular.module('copayApp.controllers').controller('createController',
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.formData = {};
var config = configService.getSync();
+ var defaults = configService.getDefaults();
var tc = $state.current.name == 'tabs.add.create-personal' ? 1 : defaults.wallet.totalCopayers;
$scope.formData.account = 1;
$scope.formData.bwsurl = data.stateParams.coin == 'btc' ? defaults.bws.url : defaults.bwscash.url;
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.coin = data.stateParams.coin;
+ $scope.bitcoinAlias = (config.bitcoinAlias || defaults.bitcoinAlias).toUpperCase();
+ $scope.bitcoinCashAlias = (config.bitcoinCashAlias || defaults.bitcoinCashAlias).toUpperCase();
if (config.cashSupport) $scope.enableCash = true;
diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js
index 3c8008830..efc6c15a8 100644
--- a/src/js/controllers/import.js
+++ b/src/js/controllers/import.js
@@ -23,6 +23,9 @@ angular.module('copayApp.controllers').controller('importController',
value: false
};
+ $scope.bitcoinAlias = (config.bitcoinAlias || defaults.bitcoinAlias).toUpperCase();
+ $scope.bitcoinCashAlias = (config.bitcoinCashAlias || defaults.bitcoinCashAlias).toUpperCase();
+
if (config.cashSupport) $scope.enableCash = true;
if ($stateParams.code)
diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js
index 7f813b703..3d1bb45d3 100644
--- a/src/js/controllers/join.js
+++ b/src/js/controllers/join.js
@@ -13,6 +13,8 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.formData.account = 1;
$scope.formData.secret = null;
$scope.formData.coin = data.stateParams.coin;
+ $scope.bitcoinAlias = (config.bitcoinAlias || defaults.bitcoinAlias).toUpperCase();
+ $scope.bitcoinCashAlias = (config.bitcoinCashAlias || defaults.bitcoinCashAlias).toUpperCase();
if (config.cashSupport) $scope.enableCash = true;
resetPasswordFields();
updateSeedSourceSelect();
diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js
index 2f112d21c..d71c96ca2 100644
--- a/src/js/controllers/walletDetails.js
+++ b/src/js/controllers/walletDetails.js
@@ -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);
diff --git a/src/js/services/configService.js b/src/js/services/configService.js
index ed5bcee21..358054c18 100644
--- a/src/js/services/configService.js
+++ b/src/js/services/configService.js
@@ -104,6 +104,9 @@ angular.module('copayApp.services').factory('configService', function(storageSer
log: {
filter: 'debug',
},
+
+ bitcoinAlias: 'btc',
+ bitcoinCashAlias: 'bcc'
};
var configCache = null;
diff --git a/src/js/services/txFormatService.js b/src/js/services/txFormatService.js
index a8bc292c6..f780b659c 100644
--- a/src/js/services/txFormatService.js
+++ b/src/js/services/txFormatService.js
@@ -18,8 +18,13 @@ angular.module('copayApp.services').factory('txFormatService', function($filter,
};
root.formatAmountStr = function(coin, satoshis) {
+ var defaults = configService.getDefaults();
+ var configCache = configService.getSync();
+ var c = coin == 'btc' ? (configCache.bitcoinAlias || defaults.bitcoinAlias)
+ : (configCache.bitcoinCashAlias || defaults.bitcoinCashAlias);
+
if (isNaN(satoshis)) return;
- return root.formatAmount(satoshis) + ' ' + (coin).toUpperCase();
+ return root.formatAmount(satoshis) + ' ' + (c).toUpperCase();
};
root.toFiat = function(coin, satoshis, code, cb) {
diff --git a/www/views/includes/cash.html b/www/views/includes/cash.html
index 17c7c2fe8..e54253c8f 100644
--- a/www/views/includes/cash.html
+++ b/www/views/includes/cash.html
@@ -3,7 +3,7 @@
Coin
diff --git a/www/views/includes/walletHistory.html b/www/views/includes/walletHistory.html
index 81124ab7d..ac6db0f72 100644
--- a/www/views/includes/walletHistory.html
+++ b/www/views/includes/walletHistory.html
@@ -30,7 +30,7 @@
Amount too low to spend
-
+