Adds bitcoin cash basic support (unit convertion, integrations, request specific amount, etc)

This commit is contained in:
Gustavo Maximiliano Cortez 2017-08-24 17:02:49 -03:00
commit 94363704ab
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
24 changed files with 376 additions and 302 deletions

View file

@ -21,6 +21,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
$scope.nextStep = data.stateParams.nextStep;
$scope.currency = data.stateParams.currency;
$scope.forceCurrency = data.stateParams.forceCurrency;
$scope.forceChain = data.stateParams.forceChain || null;
$scope.chain = $scope.forceChain || data.stateParams.chain || 'BTC';
$scope.showMenu = $ionicHistory.backView() && ($ionicHistory.backView().stateName == 'tabs.send' ||
$ionicHistory.backView().stateName == 'tabs.bitpayCard');
@ -63,7 +65,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
});
var config = configService.getSync().wallet.settings;
$scope.unitName = config.unitName;
if (data.stateParams.currency) {
$scope.alternativeIsoCode = data.stateParams.currency;
} else {
@ -124,6 +125,12 @@ angular.module('copayApp.controllers').controller('amountController', function($
}
};
$scope.toggleChain = function() {
if ($scope.forceCurrency || $scope.forceChain) return;
$scope.chain = $scope.chain == 'BTC' ? 'BCH' : 'BTC';
};
function checkFontSize() {
if ($scope.amount && $scope.amount.length >= SMALL_FONT_SIZE_LIMIT) $scope.smallFont = true;
else $scope.smallFont = false;
@ -227,7 +234,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
$state.transitionTo($scope.nextStep, {
id: _id,
amount: $scope.useSendMax ? null : _amount,
currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : $scope.unitName,
currency: $scope.showAlternativeAmount ? $scope.alternativeIsoCode : $scope.chain,
chain: $scope.chain,
useSendMax: $scope.useSendMax
});
} else {
@ -239,6 +247,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
toName: $scope.toName,
toEmail: $scope.toEmail,
toColor: $scope.toColor,
chain: $scope.chain,
useSendMax: $scope.useSendMax
});
}