clean up, migrate to no-fix amount

This commit is contained in:
Jean-Baptiste Dominguez 2018-09-05 12:45:20 +09:00
commit f7cde7a071
4 changed files with 57 additions and 54 deletions

View file

@ -2,7 +2,7 @@
angular.module('copayApp.controllers').controller('amountController', amountController);
function amountController(configService, $filter, gettextCatalog, $ionicHistory, $ionicModal, $ionicScrollDelegate, lodash, $log, nodeWebkitService, rateService, $scope, $state, $timeout, sendFlowService, shapeshiftService, txFormatService, platformInfo, profileService, walletService, $window) {
function amountController(configService, $filter, gettextCatalog, $ionicModal, $ionicScrollDelegate, lodash, $log, nodeWebkitService, rateService, $scope, $state, $timeout, sendFlowService, shapeshiftService, txFormatService, platformInfo, profileService, walletService, $window, ongoingProcess) {
var vm = this;
vm.allowSend = false;
@ -74,7 +74,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
initCurrencies();
passthroughParams = sendFlowService.state.getClone();
console.log('amount onBeforeEnter after back sendflow ', passthroughParams);
vm.fromWalletId = passthroughParams.fromWalletId;
@ -94,9 +93,11 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
vm.fromWallet = profileService.getWallet(vm.fromWalletId);
vm.toWallet = profileService.getWallet(vm.toWalletId);
ongoingProcess.set('connectingShapeshift', true);
shapeshiftService.getMarketData(vm.fromWallet.coin, vm.toWallet.coin, function(data) {
vm.thirdParty.data['minAmount'] = vm.minAmount = parseFloat(data.minimum);
vm.thirdParty.data['maxAmount'] = vm.maxAmount = parseFloat(data.maxLimit);
ongoingProcess.set('connectingShapeshift', false);
});
}
}
@ -113,7 +114,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
var reOp = /^[\*\+\-\/]$/;
if (!isAndroid && !isIos) {
var disableKeys = angular.element($window).on('keydown', function(e) {
angular.element($window).on('keydown', function(e) {
if (!e.key) return;
if (e.which === 8) { // you can add others here inside brackets.
if (!altCurrencyModal) {

View file

@ -507,10 +507,12 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
return;
}
shapeshiftService.shiftIt(vm.originWallet.coin, toWallet.coin, withdrawalAddr, returnAddr, function onShiftIt(err, shapeshiftData) {
// Need to use the correct service to do it.
var amount = parseFloat(satoshis / 100000000);
shapeshiftService.shiftIt(vm.originWallet.coin, toWallet.coin, withdrawalAddr, returnAddr, amount, function onShiftIt(err, shapeshiftData) {
if (err) {
ongoingProcess.set('connectingShapeshift', false);
popupService.showAlert(gettextCatalog.getString('Shapeshift Error'), err.toString(), function () {
popupService.showAlert(gettextCatalog.getString('Shapeshift Error'), err, function () {
$ionicHistory.goBack();
});
} else {
@ -520,6 +522,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
vm.destination.address = toAddress;
vm.destination.kind = 'shapeshift';
}
ongoingProcess.set('connectingShapeshift', false);
});
});
});