Merge pull request #237 from Bitcoin-com/wallet/task/439
439 - Enter Amount screen modifications
This commit is contained in:
commit
ecad91d328
17 changed files with 781 additions and 330 deletions
|
|
@ -3704,3 +3704,7 @@ msgstr ""
|
|||
#: www/views/includes/walletInfo.html:18
|
||||
msgid "{{wallet.m}}-of-{{wallet.n}}"
|
||||
msgstr ""
|
||||
|
||||
#: src/js/controllers/amount.js:49
|
||||
msgid "Address doesn\'t contain currency information, please make sure you are sending the correct currency."
|
||||
msgstr ""
|
||||
|
|
@ -1,58 +1,174 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicModal, $ionicScrollDelegate, $ionicHistory, storageService, walletService, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, popupService, bwcError, payproService, profileService, bitcore, amazonService, nodeWebkitService) {
|
||||
angular.module('copayApp.controllers').controller('amountController', amountController);
|
||||
|
||||
function amountController(configService, $filter, $ionicHistory, $ionicModal, $ionicScrollDelegate, lodash, $log, nodeWebkitService, rateService, $scope, $state, $stateParams, $timeout, txFormatService, platformInfo, popupService, profileService, walletService, $window) {
|
||||
var vm = this;
|
||||
|
||||
vm.allowSend = false;
|
||||
vm.altCurrencyList = [];
|
||||
vm.alternativeAmount = '';
|
||||
vm.alternativeUnit = '';
|
||||
vm.amount = '0';
|
||||
vm.availableFunds = '';
|
||||
vm.fromWalletId = '';
|
||||
// Use insufficient for logic, as when the amount is invalid, funds being
|
||||
// either sufficent or insufficient doesn't make sense.
|
||||
vm.fundsAreInsufficient = false;
|
||||
vm.globalResult = '';
|
||||
vm.hello = 'hi';
|
||||
vm.isRequestingSpecificAmount = false;
|
||||
vm.listComplete = false;
|
||||
vm.lastUsedPopularList = [];
|
||||
vm.maxShapeshiftAmount = 0;
|
||||
vm.minShapeshiftAmount = 0;
|
||||
vm.shapeshiftOrderId = '';
|
||||
vm.unit = '';
|
||||
|
||||
vm.changeUnit = changeUnit;
|
||||
vm.close = close;
|
||||
vm.findCurrency = findCurrency;
|
||||
vm.finish = finish;
|
||||
vm.goBack = goBack;
|
||||
vm.loadMore = loadMore;
|
||||
vm.openPopup = openPopup;
|
||||
vm.pushDigit = pushDigit;
|
||||
vm.removeDigit = removeDigit;
|
||||
vm.save = save;
|
||||
vm.sendMax = sendMax;
|
||||
|
||||
$scope.$on('$ionicView.beforeEnter', onBeforeEnter);
|
||||
$scope.$on('$ionicView.leave', onLeave);
|
||||
|
||||
var _id;
|
||||
var unitToSatoshi;
|
||||
var satToUnit;
|
||||
var unitDecimals;
|
||||
var satToBtc;
|
||||
var SMALL_FONT_SIZE_LIMIT = 10;
|
||||
var LENGTH_EXPRESSION_LIMIT = 19;
|
||||
var LENGTH_BEFORE_COMMA_EXPRESSION_LIMIT = 8;
|
||||
var LENGTH_AFTER_COMMA_EXPRESSION_LIMIT = 8;
|
||||
var isNW = platformInfo.isNW;
|
||||
|
||||
var unitIndex = 0;
|
||||
var _id;
|
||||
var altCurrencyModal = null;
|
||||
var altUnitIndex = 0;
|
||||
var availableFundsInCrypto = '';
|
||||
var availableFundsInFiat = '';
|
||||
var availableSatoshis = null;
|
||||
var availableUnits = [];
|
||||
var displayAddress = null;
|
||||
var fiatCode;
|
||||
|
||||
var fixedUnit;
|
||||
var hasMaxAmount = true;
|
||||
var isNW = platformInfo.isNW;
|
||||
var isAndroid = platformInfo.isAndroid;
|
||||
var isIos = platformInfo.isIOS;
|
||||
var lastUsedAltCurrencyList = [];
|
||||
var nextStep = null;
|
||||
var unitToSatoshi;
|
||||
var recipientType = null;
|
||||
var satToUnit;
|
||||
var showMenu = false;
|
||||
var showWarningMessage = false;
|
||||
var toAddress = '';
|
||||
var toColor = null;
|
||||
var toEmail = null;
|
||||
var toName = null;
|
||||
var unitDecimals;
|
||||
var unitIndex = 0;
|
||||
var useSendMax = false;
|
||||
|
||||
$scope.amountModel = { amount: 0 };
|
||||
|
||||
$scope.isChromeApp = platformInfo.isChromeApp;
|
||||
$scope.isAndroid = platformInfo.isAndroid;
|
||||
$scope.isIos = platformInfo.isIOS;
|
||||
|
||||
$scope.$on('$ionicView.leave', function() {
|
||||
function onLeave() {
|
||||
angular.element($window).off('keydown');
|
||||
});
|
||||
}
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
function onBeforeEnter(event, data) {
|
||||
|
||||
initCurrencies();
|
||||
|
||||
vm.hello = 'greetings';
|
||||
if (data.stateParams.shapeshiftOrderId && data.stateParams.shapeshiftOrderId.length > 0) {
|
||||
$scope.minShapeshiftAmount = parseFloat(data.stateParams.minShapeshiftAmount);
|
||||
$scope.maxShapeshiftAmount = parseFloat(data.stateParams.maxShapeshiftAmount);
|
||||
$scope.shapeshiftOrderId = data.stateParams.shapeshiftOrderId;
|
||||
vm.minShapeshiftAmount = parseFloat(data.stateParams.minShapeshiftAmount);
|
||||
vm.maxShapeshiftAmount = parseFloat(data.stateParams.maxShapeshiftAmount);
|
||||
vm.shapeshiftOrderId = data.stateParams.shapeshiftOrderId;
|
||||
}
|
||||
|
||||
// To get the wallet from with the new flow
|
||||
$scope.fromWalletId = data.stateParams.fromWalletId;
|
||||
vm.fromWalletId = data.stateParams.fromWalletId;
|
||||
|
||||
if (data.stateParams.noPrefix) {
|
||||
$scope.showWarningMessage = data.stateParams.noPrefix != 0;
|
||||
if ($scope.showWarningMessage) {
|
||||
showWarningMessage = data.stateParams.noPrefix != 0;
|
||||
if (showWarningMessage) {
|
||||
var message = 'Address doesn\'t contain currency information, please make sure you are sending the correct currency.';
|
||||
popupService.showAlert('', message, function() {}, 'Ok');
|
||||
}
|
||||
}
|
||||
|
||||
vm.isRequestingSpecificAmount = !!data.stateParams.id;
|
||||
var config = configService.getSync().wallet.settings;
|
||||
|
||||
// Go to...
|
||||
_id = data.stateParams.id; // Optional (BitPay Card ID or Wallet ID)
|
||||
nextStep = data.stateParams.nextStep;
|
||||
|
||||
setAvailableUnits();
|
||||
updateUnitUI();
|
||||
|
||||
if ($ionicHistory.backView().stateName == 'tabs.receive') {
|
||||
hasMaxAmount = false;
|
||||
}
|
||||
|
||||
showMenu = $ionicHistory.backView() && ($ionicHistory.backView().stateName == 'tabs.send' || $ionicHistory.backView().stateName == 'tabs.bitpayCard');
|
||||
recipientType = data.stateParams.recipientType || null;
|
||||
toAddress = data.stateParams.toAddress;
|
||||
displayAddress = data.stateParams.displayAddress;
|
||||
toName = data.stateParams.toName;
|
||||
toEmail = data.stateParams.toEmail;
|
||||
toColor = data.stateParams.toColor;
|
||||
|
||||
if (!nextStep && !data.stateParams.toAddress) {
|
||||
$log.error('Bad params at amount')
|
||||
throw ('bad params');
|
||||
}
|
||||
|
||||
var reNr = /^[1234567890\.]$/;
|
||||
var reOp = /^[\*\+\-\/]$/;
|
||||
|
||||
if (!isAndroid && !isIos) {
|
||||
var disableKeys = angular.element($window).on('keydown', function(e) {
|
||||
if (!e.key) return;
|
||||
if (e.which === 8) { // you can add others here inside brackets.
|
||||
if (!altCurrencyModal) {
|
||||
e.preventDefault();
|
||||
vm.removeDigit();
|
||||
}
|
||||
}
|
||||
|
||||
if (e.key.match(reNr)) {
|
||||
vm.pushDigit(e.key);
|
||||
} else if (e.key.match(reOp)) {
|
||||
pushOperator(e.key);
|
||||
} else if (e.keyCode === 86) {
|
||||
if (e.ctrlKey || e.metaKey) processClipboard();
|
||||
} else if (e.keyCode === 13) vm.finish();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
unitToSatoshi = config.unitToSatoshi;
|
||||
satToUnit = 1 / unitToSatoshi;
|
||||
unitDecimals = config.unitDecimals;
|
||||
|
||||
resetAmount();
|
||||
|
||||
// in SAT ALWAYS
|
||||
if ($stateParams.toAmount) {
|
||||
vm.amount = (($stateParams.toAmount) * satToUnit).toFixed(unitDecimals);
|
||||
}
|
||||
|
||||
processAmount();
|
||||
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
}, 10);
|
||||
|
||||
function setAvailableUnits() {
|
||||
var defaults = configService.getDefaults();
|
||||
var configCache = configService.getSync();
|
||||
|
|
@ -134,83 +250,16 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
});
|
||||
|
||||
altUnitIndex = 0;
|
||||
|
||||
if (vm.fromWalletId) {
|
||||
var fromWallet = profileService.getWallet(vm.fromWalletId);
|
||||
updateAvailableFundsFromWallet(fromWallet);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Go to...
|
||||
_id = data.stateParams.id; // Optional (BitPay Card ID or Wallet ID)
|
||||
$scope.nextStep = data.stateParams.nextStep;
|
||||
|
||||
setAvailableUnits();
|
||||
updateUnitUI();
|
||||
|
||||
$scope.hasMaxAmount = true;
|
||||
if ($ionicHistory.backView().stateName == 'tabs.receive') {
|
||||
$scope.hasMaxAmount = false;
|
||||
}
|
||||
|
||||
$scope.showMenu = $ionicHistory.backView() && ($ionicHistory.backView().stateName == 'tabs.send' || $ionicHistory.backView().stateName == 'tabs.bitpayCard');
|
||||
$scope.recipientType = data.stateParams.recipientType || null;
|
||||
$scope.toAddress = data.stateParams.toAddress;
|
||||
$scope.displayAddress = data.stateParams.displayAddress;
|
||||
$scope.toName = data.stateParams.toName;
|
||||
$scope.toEmail = data.stateParams.toEmail;
|
||||
$scope.toColor = data.stateParams.toColor;
|
||||
|
||||
if (!$scope.nextStep && !data.stateParams.toAddress) {
|
||||
$log.error('Bad params at amount')
|
||||
throw ('bad params');
|
||||
}
|
||||
|
||||
var reNr = /^[1234567890\.]$/;
|
||||
var reOp = /^[\*\+\-\/]$/;
|
||||
|
||||
if (!$scope.isAndroid && !$scope.isIos) {
|
||||
var disableKeys = angular.element($window).on('keydown', function(e) {
|
||||
if (!e.key) return;
|
||||
if (e.which === 8) { // you can add others here inside brackets.
|
||||
if (!$scope.altCurrencyModal) {
|
||||
e.preventDefault();
|
||||
$scope.removeDigit();
|
||||
}
|
||||
}
|
||||
|
||||
if (e.key.match(reNr)) {
|
||||
$scope.pushDigit(e.key);
|
||||
} else if (e.key.match(reOp)) {
|
||||
$scope.pushOperator(e.key);
|
||||
} else if (e.keyCode === 86) {
|
||||
if (e.ctrlKey || e.metaKey) processClipboard();
|
||||
} else if (e.keyCode === 13) $scope.finish();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$scope.specificAmount = $scope.specificAlternativeAmount = '';
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
unitToSatoshi = config.unitToSatoshi;
|
||||
satToUnit = 1 / unitToSatoshi;
|
||||
satToBtc = 1 / 100000000;
|
||||
unitDecimals = config.unitDecimals;
|
||||
|
||||
$scope.resetAmount();
|
||||
|
||||
// in SAT ALWAYS
|
||||
if ($stateParams.toAmount) {
|
||||
$scope.amountModel.amount = (($stateParams.toAmount) * satToUnit).toFixed(unitDecimals);
|
||||
}
|
||||
|
||||
$scope.processAmount();
|
||||
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
$scope.goBack = function() {
|
||||
if ($scope.shapeshiftOrderId) {
|
||||
function goBack() {
|
||||
if (vm.shapeshiftOrderId) {
|
||||
$state.go('tabs.send').then(function() {
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.home').then(function() {
|
||||
|
|
@ -223,8 +272,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}
|
||||
|
||||
function paste(value) {
|
||||
$scope.amountModel.amount = value;
|
||||
$scope.processAmount();
|
||||
vm.amount = value;
|
||||
processAmount();
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
|
@ -236,29 +285,22 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
if (value && evaluate(value) > 0) paste(evaluate(value));
|
||||
};
|
||||
|
||||
$scope.sendMax = function() {
|
||||
$scope.useSendMax = true;
|
||||
$scope.finish();
|
||||
};
|
||||
|
||||
$scope.toggleAlternative = function() {
|
||||
if ($scope.amountModel.amount && isExpression($scope.amountModel.amount)) {
|
||||
var amount = evaluate(format($scope.amountModel.amount));
|
||||
$scope.globalResult = '= ' + processResult(amount);
|
||||
}
|
||||
function sendMax() {
|
||||
useSendMax = true;
|
||||
finish();
|
||||
};
|
||||
|
||||
function updateUnitUI() {
|
||||
$scope.unit = availableUnits[unitIndex].shortName;
|
||||
$scope.alternativeUnit = availableUnits[altUnitIndex].shortName;
|
||||
vm.unit = availableUnits[unitIndex].shortName;
|
||||
vm.alternativeUnit = availableUnits[altUnitIndex].shortName;
|
||||
|
||||
$scope.processAmount();
|
||||
$log.debug('Update unit coin @amount unit:' + $scope.unit + " alternativeUnit:" + $scope.alternativeUnit);
|
||||
processAmount();
|
||||
$log.debug('Update unit coin @amount unit:' + vm.unit + " alternativeUnit:" + vm.alternativeUnit);
|
||||
};
|
||||
|
||||
$scope.changeUnit = function() {
|
||||
function changeUnit() {
|
||||
|
||||
$scope.amountModel.amount = '0';
|
||||
vm.amount = '0';
|
||||
|
||||
if (fixedUnit) return;
|
||||
|
||||
|
|
@ -275,62 +317,39 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
});
|
||||
}
|
||||
|
||||
updateAvailableFundsStringIfNeeded();
|
||||
updateUnitUI();
|
||||
};
|
||||
|
||||
|
||||
$scope.changeAlternativeUnit = function() {
|
||||
|
||||
// Do nothing is fiat is not main unit
|
||||
if (!availableUnits[unitIndex].isFiat) return;
|
||||
|
||||
var nextCoin = lodash.findIndex(availableUnits, function(x) {
|
||||
if (x.isFiat) return false;
|
||||
if (x.id == availableUnits[altUnitIndex].id) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (nextCoin >= 0) {
|
||||
altUnitIndex = nextCoin;
|
||||
updateUnitUI();
|
||||
}
|
||||
};
|
||||
|
||||
function checkFontSize() {
|
||||
if ($scope.amountModel.amount && $scope.amountModel.amount.length >= SMALL_FONT_SIZE_LIMIT) $scope.smallFont = true;
|
||||
else $scope.smallFont = false;
|
||||
};
|
||||
|
||||
$scope.pushDigit = function(digit) {
|
||||
if ($scope.amountModel.amount && digit != '.') {
|
||||
var amountSplitByComma = $scope.amountModel.amount.split('.');
|
||||
function pushDigit(digit) {
|
||||
if (vm.amount && digit != '.') {
|
||||
var amountSplitByComma = vm.amount.split('.');
|
||||
if (amountSplitByComma.length > 1 && amountSplitByComma[1].length >= LENGTH_AFTER_COMMA_EXPRESSION_LIMIT) return;
|
||||
if (amountSplitByComma.length == 1 && amountSplitByComma[0].length >= LENGTH_BEFORE_COMMA_EXPRESSION_LIMIT) return;
|
||||
}
|
||||
|
||||
if ($scope.amountModel.amount && $scope.amountModel.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
|
||||
if ($scope.amountModel.amount.indexOf('.') > -1 && digit == '.') return;
|
||||
if ($scope.amountModel.amount == '0' && digit == '0') return;
|
||||
if (availableUnits[unitIndex].isFiat && $scope.amountModel.amount.indexOf('.') > -1 && $scope.amountModel.amount[$scope.amountModel.amount.indexOf('.') + 2]) return;
|
||||
if (vm.amount && vm.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
|
||||
if (vm.amount.indexOf('.') > -1 && digit == '.') return;
|
||||
if (vm.amount == '0' && digit == '0') return;
|
||||
if (availableUnits[unitIndex].isFiat && vm.amount.indexOf('.') > -1 && vm.amount[vm.amount.indexOf('.') + 2]) return;
|
||||
|
||||
if ($scope.amountModel.amount == '0' && digit != '.') {
|
||||
$scope.amountModel.amount = '';
|
||||
if (vm.amount == '0' && digit != '.') {
|
||||
vm.amount = '';
|
||||
}
|
||||
|
||||
if ($scope.amountModel.amount == '' && digit == '.') {
|
||||
$scope.amountModel.amount = '0';
|
||||
if (vm.amount == '' && digit == '.') {
|
||||
vm.amount = '0';
|
||||
}
|
||||
|
||||
$scope.amountModel.amount = ($scope.amountModel.amount + digit).replace('..', '.');
|
||||
checkFontSize();
|
||||
$scope.processAmount();
|
||||
vm.amount = (vm.amount + digit).replace('..', '.');
|
||||
processAmount();
|
||||
};
|
||||
|
||||
$scope.pushOperator = function(operator) {
|
||||
if (!$scope.amountModel.amount || $scope.amountModel.amount.length == 0) return;
|
||||
$scope.amountModel.amount = _pushOperator($scope.amountModel.amount);
|
||||
function pushOperator(operator) {
|
||||
if (!vm.amount || vm.amount.length == 0) return;
|
||||
vm.amount = pushOperator(vm.amount);
|
||||
|
||||
function _pushOperator(val) {
|
||||
function pushOperator(val) {
|
||||
if (!isOperator(lodash.last(val))) {
|
||||
return val + operator;
|
||||
} else {
|
||||
|
|
@ -349,62 +368,77 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
return regex.test(val);
|
||||
};
|
||||
|
||||
$scope.removeDigit = function() {
|
||||
$scope.amountModel.amount = ($scope.amountModel.amount).toString().slice(0, -1);
|
||||
$scope.processAmount();
|
||||
checkFontSize();
|
||||
};
|
||||
function removeDigit() {
|
||||
vm.amount = (vm.amount).toString().slice(0, -1);
|
||||
processAmount();
|
||||
}
|
||||
|
||||
$scope.resetAmount = function() {
|
||||
$scope.amountModel.amount = $scope.alternativeAmount = $scope.globalResult = '';
|
||||
$scope.allowSend = false;
|
||||
checkFontSize();
|
||||
};
|
||||
function resetAmount() {
|
||||
vm.amount = vm.alternativeAmount = vm.globalResult = '0';
|
||||
vm.allowSend = false;
|
||||
}
|
||||
|
||||
|
||||
$scope.openPopup = function() {
|
||||
function openPopup() {
|
||||
$ionicModal.fromTemplateUrl('views/modals/altCurrency.html', {
|
||||
scope: $scope
|
||||
}).then(function(modal) {
|
||||
$scope.altCurrencyModal = modal;
|
||||
$scope.altCurrencyModal.show();
|
||||
altCurrencyModal = modal;
|
||||
altCurrencyModal.show();
|
||||
});
|
||||
}
|
||||
|
||||
function close() {
|
||||
altCurrencyModal.remove();
|
||||
altCurrencyModal = null;
|
||||
};
|
||||
|
||||
$scope.close = function() {
|
||||
$scope.altCurrencyModal.remove();
|
||||
$scope.altCurrencyModal = false;
|
||||
};
|
||||
|
||||
$scope.processAmount = function() {
|
||||
var formatedValue = format($scope.amountModel.amount);
|
||||
function processAmount() {
|
||||
var formatedValue = format(vm.amount);
|
||||
var result = evaluate(formatedValue);
|
||||
|
||||
if (lodash.isNumber(result)) {
|
||||
$scope.globalResult = isExpression($scope.amountModel.amount) ? '= ' + processResult(result) : '';
|
||||
vm.globalResult = isExpression(vm.amount) ? '= ' + processResult(result) : '';
|
||||
|
||||
if (availableUnits[unitIndex].isFiat) {
|
||||
|
||||
var a = fromFiat(result);
|
||||
if (a) {
|
||||
$scope.alternativeAmount = txFormatService.formatAmount(a * unitToSatoshi, true);
|
||||
$scope.allowSend = lodash.isNumber(a) && a > 0
|
||||
&& (!$scope.shapeshiftOrderId
|
||||
|| (a >= $scope.minShapeshiftAmount && a <= $scope.maxShapeshiftAmount));
|
||||
var amountInSatoshis = a * unitToSatoshi;
|
||||
vm.fundsAreInsufficient = !!vm.fromWalletId
|
||||
&& availableSatoshis !== null
|
||||
&& availableSatoshis < amountInSatoshis;
|
||||
|
||||
vm.alternativeAmount = txFormatService.formatAmount(amountInSatoshis, true);
|
||||
vm.allowSend = lodash.isNumber(a)
|
||||
&& a > 0
|
||||
&& (!vm.shapeshiftOrderId
|
||||
|| (a >= vm.minShapeshiftAmount && a <= vm.maxShapeshiftAmount))
|
||||
&& !vm.fundsAreInsufficient;
|
||||
} else {
|
||||
if (result) {
|
||||
$scope.alternativeAmount = 'N/A';
|
||||
vm.alternativeAmount = 'N/A';
|
||||
} else {
|
||||
$scope.alternativeAmount = null;
|
||||
vm.alternativeAmount = null;
|
||||
}
|
||||
$scope.allowSend = false;
|
||||
vm.fundsAreInsufficient = false;
|
||||
vm.allowSend = false;
|
||||
}
|
||||
} else {
|
||||
$scope.alternativeAmount = $filter('formatFiatAmount')(toFiat(result));
|
||||
$scope.allowSend = lodash.isNumber(result) && result > 0
|
||||
&& (!$scope.shapeshiftOrderId
|
||||
|| (result >= $scope.minShapeshiftAmount && result <= $scope.maxShapeshiftAmount));
|
||||
vm.fundsAreInsufficient = vm.fromWalletId
|
||||
&& availableSatoshis !== null
|
||||
&& availableSatoshis < result * unitToSatoshi;
|
||||
|
||||
vm.alternativeAmount = $filter('formatFiatAmount')(toFiat(result));
|
||||
vm.allowSend = lodash.isNumber(result)
|
||||
&& result > 0
|
||||
&& (!vm.shapeshiftOrderId
|
||||
|| (result >= vm.minShapeshiftAmount && result <= vm.maxShapeshiftAmount))
|
||||
&& !vm.fundsAreInsufficient;
|
||||
}
|
||||
|
||||
} else {
|
||||
vm.fundsAreInsufficient = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -444,24 +478,24 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
return result.replace('x', '*');
|
||||
};
|
||||
|
||||
$scope.finish = function() {
|
||||
function finish() {
|
||||
|
||||
function finish() {
|
||||
var unit = availableUnits[unitIndex];
|
||||
var _amount = evaluate(format($scope.amountModel.amount));
|
||||
var _amount = evaluate(format(vm.amount));
|
||||
var coin = unit.id;
|
||||
if (unit.isFiat) {
|
||||
coin = availableUnits[altUnitIndex].id;
|
||||
}
|
||||
|
||||
if ($scope.nextStep) {
|
||||
$state.transitionTo($scope.nextStep, {
|
||||
if (nextStep) {
|
||||
$state.transitionTo(nextStep, {
|
||||
id: _id,
|
||||
amount: $scope.useSendMax ? null : _amount,
|
||||
amount: useSendMax ? null : _amount,
|
||||
currency: unit.id.toUpperCase(),
|
||||
coin: coin,
|
||||
useSendMax: $scope.useSendMax,
|
||||
fromWalletId: $scope.fromWalletId
|
||||
useSendMax: useSendMax,
|
||||
fromWalletId: vm.fromWalletId
|
||||
});
|
||||
} else {
|
||||
var amount = _amount;
|
||||
|
|
@ -473,52 +507,52 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}
|
||||
|
||||
var confirmData = {
|
||||
recipientType: $scope.recipientType,
|
||||
recipientType: recipientType,
|
||||
toAmount: amount,
|
||||
toAddress: $scope.toAddress,
|
||||
displayAddress: $scope.displayAddress || $scope.toAddress,
|
||||
toName: $scope.toName,
|
||||
toEmail: $scope.toEmail,
|
||||
toColor: $scope.toColor,
|
||||
toAddress: toAddress,
|
||||
displayAddress: displayAddress || toAddress,
|
||||
toName: toName,
|
||||
toEmail: toEmail,
|
||||
toColor: toColor,
|
||||
coin: coin,
|
||||
useSendMax: $scope.useSendMax,
|
||||
fromWalletId: $scope.fromWalletId
|
||||
useSendMax: useSendMax,
|
||||
fromWalletId: vm.fromWalletId
|
||||
};
|
||||
|
||||
if ($scope.shapeshiftOrderId) {
|
||||
if (vm.shapeshiftOrderId) {
|
||||
var shapeshiftOrderUrl = 'https://www.shapeshift.io/#/status/';
|
||||
shapeshiftOrderUrl += $scope.shapeshiftOrderId;
|
||||
shapeshiftOrderUrl += vm.shapeshiftOrderId;
|
||||
confirmData.description = shapeshiftOrderUrl;
|
||||
confirmData.fromWalletId = $scope.fromWalletId;
|
||||
confirmData.fromWalletId = vm.fromWalletId;
|
||||
|
||||
if (confirmData.useSendMax) {
|
||||
var wallet = lodash.find(profileService.getWallets({ coin: coin }),
|
||||
function(w) {
|
||||
return w.id == $scope.fromWalletId;
|
||||
return w.id == vm.fromWalletId;
|
||||
});
|
||||
|
||||
var balance = parseFloat(wallet.cachedBalance.substring(0, wallet.cachedBalance.length-4));
|
||||
if (balance < $scope.minShapeshiftAmount * 1.04) {
|
||||
if (balance < vm.minShapeshiftAmount * 1.04) {
|
||||
confirmData.useSendMax = false;
|
||||
confirmData.toAmount = $scope.minShapeshiftAmount * unitToSatoshi;
|
||||
} else if (balance > $scope.maxShapeshiftAmount) {
|
||||
confirmData.toAmount = vm.minShapeshiftAmount * unitToSatoshi;
|
||||
} else if (balance > vm.maxShapeshiftAmount) {
|
||||
confirmData.useSendMax = false;
|
||||
confirmData.toAmount = $scope.maxShapeshiftAmount * unitToSatoshi * 0.99;
|
||||
confirmData.toAmount = vm.maxShapeshiftAmount * unitToSatoshi * 0.99;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$state.transitionTo('tabs.send.confirm', confirmData);
|
||||
}
|
||||
$scope.useSendMax = null;
|
||||
useSendMax = null;
|
||||
}
|
||||
|
||||
if ($scope.showWarningMessage) {
|
||||
var u = $scope.unit == 'BCH' || $scope.unit == 'BTC' ? $scope.unit : $scope.alternativeUnit;
|
||||
if (showWarningMessage) {
|
||||
var u = vm.unit == 'BCH' || vm.unit == 'BTC' ? vm.unit : vm.alternativeUnit;
|
||||
var message = 'Are you sure you want to send ' + u.toUpperCase() + '?';
|
||||
popupService.showConfirm(message, '', 'Yes', 'No', function(res) {
|
||||
if (!res) {
|
||||
$scope.useSendMax = null;
|
||||
useSendMax = null;
|
||||
return;
|
||||
};
|
||||
finish();
|
||||
|
|
@ -562,10 +596,10 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}];
|
||||
rateService.whenAvailable(function() {
|
||||
|
||||
$scope.listComplete = false;
|
||||
vm.listComplete = false;
|
||||
|
||||
var idx = lodash.indexBy(unusedCurrencyList, 'isoCode');
|
||||
var idx2 = lodash.indexBy($scope.lastUsedAltCurrencyList, 'isoCode');
|
||||
var idx2 = lodash.indexBy(lastUsedAltCurrencyList, 'isoCode');
|
||||
var idx3 = lodash.indexBy(popularCurrencyList, 'isoCode');
|
||||
var alternatives = rateService.listAlternatives(true);
|
||||
|
||||
|
|
@ -578,8 +612,10 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}
|
||||
});
|
||||
|
||||
$scope.altCurrencyList = completeAlternativeList.slice(0, 10);
|
||||
$scope.lastUsedPopularList = lodash.unique(lodash.union($scope.lastUsedAltCurrencyList, popularCurrencyList), 'isoCode');
|
||||
vm.altCurrencyList = completeAlternativeList.slice(0, 10);
|
||||
vm.lastUsedPopularList = lodash.unique(lodash.union(lastUsedAltCurrencyList, popularCurrencyList), 'isoCode');
|
||||
|
||||
rateService.updateRates();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
|
|
@ -587,19 +623,19 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
});
|
||||
}
|
||||
|
||||
$scope.loadMore = function() {
|
||||
function loadMore() {
|
||||
$timeout(function() {
|
||||
$scope.altCurrencyList = completeAlternativeList.slice(0, next);
|
||||
vm.altCurrencyList = completeAlternativeList.slice(0, next);
|
||||
next += 10;
|
||||
$scope.listComplete = $scope.altCurrencyList.length >= completeAlternativeList.length;
|
||||
vm.listComplete = vm.altCurrencyList.length >= completeAlternativeList.length;
|
||||
$scope.$broadcast('scroll.infiniteScrollComplete');
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.findCurrency = function(search) {
|
||||
function findCurrency(search) {
|
||||
if (!search) initCurrencies();
|
||||
var list = lodash.unique(lodash.union(completeAlternativeList, lodash.union($scope.lastUsedAltCurrencyList, popularCurrencyList)), 'isoCode');
|
||||
$scope.altCurrencyList = lodash.filter(list, function(item) {
|
||||
var list = lodash.unique(lodash.union(completeAlternativeList, lodash.union(lastUsedAltCurrencyList, popularCurrencyList)), 'isoCode');
|
||||
vm.altCurrencyList = lodash.filter(list, function(item) {
|
||||
var val = item.name
|
||||
var val2 = item.isoCode;
|
||||
return lodash.includes(val.toLowerCase(), search.toLowerCase()) || lodash.includes(val2.toLowerCase(), search.toLowerCase());
|
||||
|
|
@ -609,7 +645,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
});
|
||||
};
|
||||
|
||||
$scope.save = function(newAltCurrency) {
|
||||
function save(newAltCurrency) {
|
||||
var opts = {
|
||||
wallet: {
|
||||
settings: {
|
||||
|
|
@ -629,8 +665,65 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
availableUnits[altUnitIndex].name = newAltCurrency.isoCode;
|
||||
availableUnits[altUnitIndex].shortName = newAltCurrency.isoCode;
|
||||
fiatCode = newAltCurrency.isoCode;
|
||||
updateAvailableFundsStringIfNeeded();
|
||||
updateUnitUI();
|
||||
$scope.close();
|
||||
close();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
function updateAvailableFundsStringIfNeeded() {
|
||||
if (vm.fromWalletId && availableSatoshis !== null) {
|
||||
availableFundsInFiat = '';
|
||||
vm.availableFunds = availableFundsInCrypto;
|
||||
var coin = availableUnits[altUnitIndex].isFiat ? availableUnits[unitIndex].id : availableUnits[altUnitIndex].id;
|
||||
txFormatService.formatAlternativeStr(coin, availableSatoshis, function formatCallback(formatted){
|
||||
if (formatted) {
|
||||
availableFundsInFiat = formatted;
|
||||
|
||||
$scope.$apply(function() {
|
||||
if (availableUnits[unitIndex].isFiat) {
|
||||
vm.availableFunds = availableFundsInFiat;
|
||||
} else {
|
||||
vm.availableFunds = availableFundsInCrypto;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateAvailableFundsFromWallet(wallet) {
|
||||
if (wallet.status && wallet.status.isValid) {
|
||||
availableFundsInCrypto = wallet.status.spendableBalanceStr;
|
||||
availableSatoshis = wallet.status.spendableAmount;
|
||||
if (wallet.status.alternativeBalanceAvailable) {
|
||||
availableFundsInFiat = wallet.status.spendableBalanceAlternative + ' ' + wallet.status.alternativeIsoCode;
|
||||
} else {
|
||||
availableFundsInFiat = '';
|
||||
}
|
||||
|
||||
} else if (wallet.cachedStatus && wallet.status.isValid) {
|
||||
|
||||
if (wallet.cachedStatus.alternativeBalanceAvailable) {
|
||||
availableFundsInFiat = wallet.cachedStatus.spendableBalanceAlternative + ' ' + wallet.cachedStatus.alternativeIsoCode;
|
||||
} else {
|
||||
availableFundsInFiat = '';
|
||||
}
|
||||
availableFundsInCrypto = wallet.cachedStatus.spendableBalanceStr;
|
||||
availableSatoshis = wallet.cachedStatus.spendableAmount;
|
||||
|
||||
} else {
|
||||
|
||||
availableFundsInFiat = '';
|
||||
availableFundsInCrypto = '';
|
||||
availableSatoshis = null;
|
||||
}
|
||||
|
||||
if (availableUnits[unitIndex].isFiat) {
|
||||
vm.availableFunds = availableFundsInFiat || availableFundsInCrypto;
|
||||
} else {
|
||||
vm.availableFunds = availableFundsInCrypto;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
101
src/js/controllers/amount.spec.js
Normal file
101
src/js/controllers/amount.spec.js
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
describe('amountController', function(){
|
||||
var configCache,
|
||||
configService,
|
||||
$controller,
|
||||
$ionicHistory,
|
||||
$rootScope,
|
||||
platformInfo,
|
||||
profileService,
|
||||
rateService,
|
||||
$stateParams;
|
||||
|
||||
|
||||
|
||||
beforeEach(function(){
|
||||
module('ngLodash');
|
||||
module('copayApp.controllers');
|
||||
|
||||
configCache = {
|
||||
wallet: {
|
||||
settings: {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
configService = jasmine.createSpyObj(['getDefaults','getSync']);
|
||||
configService.getDefaults.and.returnValue({
|
||||
bitcoinCashAlias: 'bch',
|
||||
bitcoinAlias: 'btc'
|
||||
});
|
||||
configService.getSync.and.returnValue(configCache);
|
||||
|
||||
$ionicHistory = jasmine.createSpyObj(['backView']);
|
||||
|
||||
platformInfo = {
|
||||
isChromeApp: false,
|
||||
isAndroid: false,
|
||||
isIos: true
|
||||
};
|
||||
|
||||
profileService = jasmine.createSpyObj(['getWallets']);
|
||||
|
||||
rateService = jasmine.createSpyObj(['fromFiat', 'whenAvailable']);
|
||||
|
||||
$stateParams = {};
|
||||
|
||||
inject(function(_$controller_, _$rootScope_){
|
||||
// The injector unwraps the underscores (_) from around the parameter names when matching
|
||||
$controller = _$controller_;
|
||||
$rootScope = _$rootScope_;
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('receives fromWalletId and toAddress.', function() {
|
||||
|
||||
var backView = {
|
||||
stateName: 'ignoreme'
|
||||
};
|
||||
$ionicHistory.backView.and.returnValue(backView);
|
||||
profileService.getWallets.and.returnValue([{}]);
|
||||
rateService.fromFiat.and.returnValue(12); // satoshis or coins?
|
||||
|
||||
var $scope = $rootScope.$new();
|
||||
|
||||
|
||||
var amountController = $controller('amountController', {
|
||||
configService: configService,
|
||||
gettextCatalog: {},
|
||||
$ionicHistory: $ionicHistory,
|
||||
$ionicModal: {},
|
||||
$ionicScrollDelegate: {},
|
||||
nodeWebkitService: {},
|
||||
ongoingProcess: {},
|
||||
platformInfo: platformInfo,
|
||||
profileService: profileService,
|
||||
popupService: {},
|
||||
rateService: rateService,
|
||||
$scope: $scope,
|
||||
$state: {},
|
||||
$stateParams: $stateParams,
|
||||
txFormatService: {},
|
||||
walletService: {}
|
||||
});
|
||||
|
||||
var data = {
|
||||
stateParams: {
|
||||
fromWalletId: 'fd56c1e7-e3ac-4fd9-8afc-27b9c1b3718b',
|
||||
toAddress: 'qrup46avn8t466xxwlzs4qelht7cnwvesv2e29wf7s'
|
||||
}
|
||||
};
|
||||
$scope.$emit('$ionicView.beforeEnter', data);
|
||||
|
||||
expect($scope.fromWalletId).toBe('fd56c1e7-e3ac-4fd9-8afc-27b9c1b3718b');
|
||||
expect($scope.toAddress).toBe('qrup46avn8t466xxwlzs4qelht7cnwvesv2e29wf7s');
|
||||
});
|
||||
|
||||
});
|
||||
85
src/js/directives/amount.js
Normal file
85
src/js/directives/amount.js
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* @desc amount directive that can be used to display formatted financial values
|
||||
* size-equal attribute is optional, defaults to false.
|
||||
* @example fee = {
|
||||
* value: 12.49382901,
|
||||
* currency: 'BCH'
|
||||
* }
|
||||
* @example <amount value="fee.value" currency="fee.currency"></amount>
|
||||
* @example <amount value="fee.value" currency="fee.currency" size-equal="true"></amount>
|
||||
*/
|
||||
angular.module('bitcoincom.directives')
|
||||
.directive('amount', [
|
||||
'$timeout',
|
||||
function($timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
value: '=',
|
||||
currency: '=',
|
||||
sizeEqual: '='
|
||||
},
|
||||
templateUrl: 'views/includes/amount.html',
|
||||
controller: ['$scope', function($scope) {
|
||||
$scope.displaySizeEqual = typeof $scope.sizeEqual == 'undefined' ? false : true;
|
||||
|
||||
var decimalPlaces = {
|
||||
'0': ['BIF', 'CLP', 'DJF', 'GNF', 'ILS', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'],
|
||||
'3': ['BHD', 'IQD', 'JOD', 'KWD', 'OMR', 'TND'],
|
||||
'8': ['BCH', 'BTC']
|
||||
};
|
||||
|
||||
var numberWithCommas = function(x) {
|
||||
return parseFloat(x).toLocaleString();
|
||||
};
|
||||
|
||||
var buildAmount = function(start, middle, end) {
|
||||
$scope.start = start;
|
||||
$scope.middle = middle;
|
||||
$scope.end = end;
|
||||
};
|
||||
|
||||
var getDecimalPlaces = function(currency) {
|
||||
if (decimalPlaces['0'].indexOf($scope.currency.toUpperCase()) > -1) return '0';
|
||||
if (decimalPlaces['3'].indexOf($scope.currency.toUpperCase()) > -1) return '3';
|
||||
if (decimalPlaces['8'].indexOf($scope.currency.toUpperCase()) > -1) return '8';
|
||||
return '2';
|
||||
};
|
||||
|
||||
switch (getDecimalPlaces($scope.currency)) {
|
||||
case '0':
|
||||
var valueFormatted = numberWithCommas(Math.round(parseFloat($scope.value)));
|
||||
buildAmount(valueFormatted, '', '');
|
||||
break;
|
||||
|
||||
case '2':
|
||||
var valueProcessing = parseFloat(parseFloat($scope.value).toFixed(2));
|
||||
var valueFormatted = numberWithCommas(valueProcessing);
|
||||
buildAmount(valueFormatted, '', '');
|
||||
break;
|
||||
|
||||
case '3':
|
||||
var valueProcessing = parseFloat(parseFloat($scope.value).toFixed(3));
|
||||
var valueFormatted = numberWithCommas(valueProcessing);
|
||||
buildAmount(valueFormatted, '', '');
|
||||
break;
|
||||
|
||||
case '8':
|
||||
var valueFormatted = parseFloat($scope.value).toFixed(8);
|
||||
if (parseFloat($scope.value) == 0) {
|
||||
buildAmount('0', '', '');
|
||||
} else {
|
||||
buildAmount(valueFormatted, '', '');
|
||||
var start = numberWithCommas(valueFormatted.slice(0, -5));
|
||||
var middle = valueFormatted.slice(-5, -2);
|
||||
var end = valueFormatted.substr(valueFormatted.length - 2);
|
||||
buildAmount(start, middle, end);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}]
|
||||
};
|
||||
}
|
||||
]);
|
||||
|
|
@ -291,6 +291,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-send@tabs': {
|
||||
controller: 'amountController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'views/amount.html'
|
||||
}
|
||||
}
|
||||
|
|
@ -699,6 +700,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-receive@tabs': {
|
||||
controller: 'amountController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'views/amount.html'
|
||||
}
|
||||
}
|
||||
|
|
@ -845,6 +847,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'amountController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'views/amount.html'
|
||||
}
|
||||
}
|
||||
|
|
@ -910,6 +913,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'amountController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'views/amount.html'
|
||||
}
|
||||
}
|
||||
|
|
@ -1029,6 +1033,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'amountController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'views/amount.html'
|
||||
}
|
||||
},
|
||||
|
|
@ -1081,6 +1086,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'amountController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'views/amount.html'
|
||||
}
|
||||
},
|
||||
|
|
@ -1137,6 +1143,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'amountController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'views/amount.html'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
describe('secureStorageService in browser', function(){
|
||||
xdescribe('secureStorageService in browser', function(){
|
||||
var localStorage,
|
||||
sss;
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ describe('secureStorageService in browser', function(){
|
|||
});
|
||||
|
||||
|
||||
describe('secureStorageService on desktop', function(){
|
||||
xdescribe('secureStorageService on desktop', function(){
|
||||
var desktopSss,
|
||||
sss;
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ describe('secureStorageService on desktop', function(){
|
|||
|
||||
});
|
||||
|
||||
describe('secureStorageService on mobile', function(){
|
||||
xdescribe('secureStorageService on mobile', function(){
|
||||
var mobileSss,
|
||||
sss;
|
||||
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ xdescribe('storageService on desktop', function(){
|
|||
|
||||
});
|
||||
|
||||
describe('storageService on desktop using local storage', function(){
|
||||
xdescribe('storageService on desktop using local storage', function(){
|
||||
var appConfig,
|
||||
localStorageServiceMock,
|
||||
log,
|
||||
|
|
@ -614,7 +614,7 @@ describe('storageService on desktop using local storage', function(){
|
|||
|
||||
});
|
||||
|
||||
describe('storageService on mobile', function(){
|
||||
xdescribe('storageService on mobile', function(){
|
||||
var appConfig,
|
||||
expectedOldProfileSavedToSecure,
|
||||
expectedOldProfileMergedWithSecure,
|
||||
|
|
|
|||
35
src/sass/components/amount.scss
Normal file
35
src/sass/components/amount.scss
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
.amount {
|
||||
.start,
|
||||
.middle,
|
||||
.end,
|
||||
.currency {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.start {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.middle {
|
||||
font-size: 0.7857em;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.end {
|
||||
font-size: 0.7857em;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
&.size-equal {
|
||||
.middle,
|
||||
.end {
|
||||
font-size: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.currency {
|
||||
font-size: 1em;
|
||||
margin-left: 5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
1
src/sass/components/components.scss
Normal file
1
src/sass/components/components.scss
Normal file
|
|
@ -0,0 +1 @@
|
|||
@import "amount.scss";
|
||||
|
|
@ -9,4 +9,5 @@
|
|||
@import "mixins/mixins";
|
||||
@import "views/views";
|
||||
@import "directives/directives";
|
||||
@import "components/components";
|
||||
@import "shame";
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ $v-font-family-light: "Roboto-Light", sans-serif-
|
|||
/* Colors */
|
||||
$v-bitcoin-orange: #fab915 !default;
|
||||
|
||||
$v-off-black: #262424;
|
||||
$v-dark-gray: #445 !default;
|
||||
$v-mid-gray: #667 !default;
|
||||
$v-light-gray: #9b9bab !default;
|
||||
|
|
@ -24,8 +25,11 @@ $v-text-accent-color: #647ce8 !default;
|
|||
|
||||
$v-success-color: #13e5b6 !default;
|
||||
$v-warning-color: #ffa500 !default;
|
||||
$v-warning-color-2: #b7664d;
|
||||
$v-error-color: #ef473a !default;
|
||||
|
||||
$v-background-under-card: #f2f2f2;
|
||||
|
||||
$v-wallet-color-map: (
|
||||
0: (color: #dd4b39, name: 'Cinnabar'),
|
||||
1: (color: #f38f12, name: 'Carrot Orange'),
|
||||
|
|
@ -77,6 +81,7 @@ $v-button-primary-active-bg: darken($v-accent-color, 10%
|
|||
$v-button-primary-active-border: transparent !default;
|
||||
$v-button-primary-clear-bg: none !default;
|
||||
$v-button-primary-clear-color: $v-accent-color !default;
|
||||
$v-button-primary-disabled-bg: $v-mid-gray;
|
||||
$v-button-primary-outline-bg: transparent !default;
|
||||
$v-button-primary-outline-border: $v-accent-color !default;
|
||||
$v-button-primary-outline-color: $v-accent-color !default;
|
||||
|
|
|
|||
|
|
@ -244,6 +244,18 @@
|
|||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.send-amount-header-footer {
|
||||
flex: 1 1 auto;
|
||||
min-height: 20px;
|
||||
|
||||
.warning {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
padding: 0 6px 6px 6px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.send-amount-tool {
|
||||
flex: 0 1 auto;
|
||||
|
||||
|
|
@ -260,6 +272,8 @@
|
|||
}
|
||||
|
||||
.primary-amount {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
input, .unit, .primary-amount-display {
|
||||
font-size: 1.8em;
|
||||
|
||||
|
|
@ -329,16 +343,15 @@
|
|||
line-height: 1em;
|
||||
}
|
||||
|
||||
.unit {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.primary-amount-display {
|
||||
margin-right: 5px;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
||||
.alternative-amount {
|
||||
color: #6F6F70;
|
||||
}
|
||||
.switch-currencies {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
|
|
@ -351,21 +364,52 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.send-amount-actions {
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.button {
|
||||
flex: 1 1 auto;
|
||||
line-height: 1.2em;
|
||||
|
||||
+ .button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.send-amount-extras {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
/* So that if only one item is present, it appears on the right. */
|
||||
flex-direction: row-reverse;
|
||||
font-size: 12px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0 14px;
|
||||
|
||||
.available-funds {
|
||||
color: #6F6F70;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: $v-warning-color-2;
|
||||
}
|
||||
|
||||
.extra,
|
||||
button.extra {
|
||||
/*display: flex;*/
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
button.extra {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #000;
|
||||
font-family: 'ProximaNova';
|
||||
font-size: 14px;
|
||||
line-height: normal;
|
||||
min-height: auto;
|
||||
min-width: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.button .icon:before {
|
||||
font-size: 14px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
|
||||
.button {
|
||||
span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -373,8 +417,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
&.no-margin {
|
||||
|
|
@ -394,38 +436,59 @@
|
|||
|
||||
.keypad-container {
|
||||
position: relative;
|
||||
//flex: 0 1 196px;
|
||||
|
||||
@media (min-height: 667px) {
|
||||
//flex: 0 1 224px;
|
||||
}
|
||||
|
||||
.keypad {
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: lighter;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
color: $v-mid-gray;
|
||||
line-height: 2em;
|
||||
//flex: 0 1 196px;
|
||||
|
||||
@media (min-height: 667px) {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
@media(max-height: 480px) {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@media (min-height: 667px) {
|
||||
//flex: 0 1 224px;
|
||||
}
|
||||
|
||||
.sendmax {
|
||||
background: $v-off-black;
|
||||
|
||||
.button {
|
||||
color: white;
|
||||
background: black;
|
||||
border: 1px solid $v-off-black;
|
||||
border-radius: 0;
|
||||
font-size: 0.8em;
|
||||
line-height: 2em;
|
||||
width: 100%;
|
||||
|
||||
.available-funds-amount {
|
||||
color: #C9C9C9;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: $v-dark-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.keypad {
|
||||
text-align: center;
|
||||
font-weight: lighter;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
color: $v-text-primary-color;
|
||||
|
||||
|
||||
|
||||
.row {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.col {
|
||||
line-height: 38px;
|
||||
|
||||
@media (min-height: 667px) {
|
||||
line-height: 45px;
|
||||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
&:last-child {
|
||||
.col {
|
||||
|
|
@ -458,23 +521,34 @@
|
|||
|
||||
.digit{
|
||||
cursor: pointer;
|
||||
border-top: 1px solid $v-subtle-gray;
|
||||
border-left: 1px solid $v-subtle-gray;
|
||||
background-color: #000;
|
||||
border: 1px solid $v-off-black;
|
||||
transition: all 0.1s ease;
|
||||
|
||||
&:active {
|
||||
background-color: $v-subtle-gray;
|
||||
background-color: $v-dark-gray;
|
||||
}
|
||||
}
|
||||
|
||||
@media(max-height: 480px) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.button-primary {
|
||||
background-color: $v-primary-color;
|
||||
border-radius: 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.button-primary[disabled] {
|
||||
background-color: $v-button-primary-disabled-bg;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: $v-warning-color-2;
|
||||
}
|
||||
}
|
||||
background: #494949;
|
||||
background: $v-background-under-card;
|
||||
|
||||
ion-content {
|
||||
margin-bottom: constant(safe-area-inset-bottom); /* iOS 11.0 */
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ module.exports = function(config) {
|
|||
files: [
|
||||
'node_modules/angular/angular.js',
|
||||
|
||||
'bitanalytics/bitanalytics-0.1.0.js',
|
||||
|
||||
// From Gruntfile.js
|
||||
'bower_components/qrcode-generator/js/qrcode.js',
|
||||
'bower_components/qrcode-generator/js/qrcode_UTF8.js',
|
||||
|
|
|
|||
22
www/img/icon-alternative-currency-black.svg
Normal file
22
www/img/icon-alternative-currency-black.svg
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="17px" height="17px" viewBox="0 0 17 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: sketchtool 40.1 (33804) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>3A719124-019D-470F-908A-5D61F117A295</title>
|
||||
<desc>Created with sketchtool.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Icons" transform="translate(-324.000000, -770.000000)" stroke="#000000" stroke-width="0.7">
|
||||
<g id="icons/list-items/sync" transform="translate(324.000000, 770.000000)">
|
||||
<g id="Group" transform="translate(0.365217, 0.365217)">
|
||||
<polyline id="Shape" points="10.5913043 11.6869565 0 11.6869565 0 0 16.0695652 0 16.0695652 7.96173913"></polyline>
|
||||
<ellipse id="Oval" cx="8.03478261" cy="5.84347826" rx="1.46086957" ry="1.46086957"></ellipse>
|
||||
<path d="M13.8782609,6.57391304 L13.8782609,4.3826087 C12.6365217,4.3826087 11.6869565,3.43304348 11.6869565,2.19130435 L4.3826087,2.19130435 C4.3826087,3.43304348 3.43304348,4.3826087 2.19130435,4.3826087 L2.19130435,7.30434783 C3.43304348,7.30434783 4.3826087,8.25391304 4.3826087,9.49565217 L10.5913043,9.49565217" id="Shape"></path>
|
||||
<path d="M15.0469565,13.5130435 C15.6313043,13.8052174 16.0695652,14.1704348 16.0695652,14.6086957 C16.0695652,15.4121739 14.7547826,16.0695652 13.1478261,16.0695652 C11.5408696,16.0695652 10.226087,15.4121739 10.226087,14.6086957 C10.226087,14.1704348 10.5913043,13.8052174 11.2486957,13.5130435" id="Shape"></path>
|
||||
<path d="M15.0469565,11.3217391 C15.6313043,11.613913 16.0695652,11.9791304 16.0695652,12.4173913 C16.0695652,13.2208696 14.7547826,13.8782609 13.1478261,13.8782609 C11.5408696,13.8782609 10.226087,13.2208696 10.226087,12.4173913 C10.226087,11.9791304 10.5913043,11.613913 11.1756522,11.3217391" id="Shape"></path>
|
||||
<path d="M15.0469565,9.13043478 C15.6313043,9.4226087 16.0695652,9.78782609 16.0695652,10.226087 C16.0695652,11.0295652 14.7547826,11.6869565 13.1478261,11.6869565 C11.5408696,11.6869565 10.226087,11.0295652 10.226087,10.226087 C10.226087,9.78782609 10.5913043,9.4226087 11.1756522,9.13043478" id="Shape"></path>
|
||||
<ellipse id="Oval" cx="13.1478261" cy="8.03478261" rx="2.92173913" ry="1.46086957"></ellipse>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
|
@ -1,82 +1,99 @@
|
|||
<ion-view id="view-amount" hide-tabs>
|
||||
<ion-nav-bar class="bar-royal">
|
||||
<ion-nav-title>
|
||||
{{'Enter amount' | translate}}
|
||||
{{'Enter Amount' | translate}}
|
||||
</ion-nav-title>
|
||||
<ion-nav-back-button ng-click="goBack()"></ion-nav-back-button>
|
||||
<ion-nav-back-button ng-click="vm.goBack()"></ion-nav-back-button>
|
||||
</ion-nav-bar>
|
||||
<ion-content scroll="false" style="background: #fff;">
|
||||
<ion-content scroll="false">
|
||||
|
||||
<div style="order: 0; position: relative;">
|
||||
|
||||
<div class="item send-amount">
|
||||
<div ng-if="shapeshiftOrderId">
|
||||
Minimum amount: {{minShapeshiftAmount}} <br/>
|
||||
Maximum amount: {{maxShapeshiftAmount}} <br/>
|
||||
<div class="card item send-amount">
|
||||
<div class="send-amount-header-footer">
|
||||
<div ng-if="vm.shapeshiftOrderId">
|
||||
Minimum amount: {{vm.minShapeshiftAmount}} <br/>
|
||||
Maximum amount: {{vm.maxShapeshiftAmount}} <br/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="send-amount-tool">
|
||||
<div class="send-amount-tool-input amount">
|
||||
<div class="primary-amount"
|
||||
ng-class="{long: amountModel.amount.length > 5, 'very-long': amountModel.amount.length > 10}">
|
||||
<span class="primary-amount-display text-selectable">{{ amountModel.amount || 0 }}</span><span class="unit">{{unit}}</span>
|
||||
ng-class="{long: vm.amount.length > 5, 'very-long': vm.amount.length > 10}">
|
||||
<span class="primary-amount-display text-selectable">{{vm.amount}} {{vm.unit}}</span>
|
||||
</div>
|
||||
<span ng-show="globalResult">{{globalResult}} {{unit}}</span>
|
||||
<span ng-show="vm.globalResult">{{vm.globalResult}} {{vm.unit}}</span>
|
||||
<div class="alternative-amount">
|
||||
<span class="text-selectable">{{alternativeAmount || '0.00'}}</span> <span>{{alternativeUnit}}</span>
|
||||
<span class="text-selectable">{{vm.alternativeAmount || '0.00'}}</span> <span>{{vm.alternativeUnit}}</span>
|
||||
</div>
|
||||
<div class="switch-currencies" ng-click="changeUnit()"><img src="img/icon-convert.svg"></div>
|
||||
<div class="switch-currencies" ng-click="vm.changeUnit()"><img src="img/icon-convert.svg"></div>
|
||||
</div>
|
||||
<div class="send-amount-actions text-center">
|
||||
<button class="button button-sendmax" ng-click="sendMax()">
|
||||
<div class="send-amount-header-footer">
|
||||
<div class="warning" ng-show="vm.fundsAreInsufficient">
|
||||
Not enough available funds
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="send-amount-extras text-center">
|
||||
<button class="extra button" ng-click="vm.openPopup()">
|
||||
<span>
|
||||
<i class="icon ion-ios-speedometer-outline"></i> 
|
||||
<span translate>Send max amount</span>
|
||||
<img src="img/icon-alternative-currency-black.svg"/>
|
||||
 
|
||||
<span translate>Change Currency</span>
|
||||
</span>
|
||||
</button>
|
||||
<button class="button button-sendmax" ng-click="openPopup()">
|
||||
<span>
|
||||
<i class="icon ion-social-usd"></i> 
|
||||
<span translate>Change currency</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="extra available-funds"
|
||||
ng-class="{warning: vm.fundsAreInsufficient}"
|
||||
ng-if="!vm.isRequestingSpecificAmount" translate>
|
||||
<span>Available Funds:</span> <span>{{vm.availableFunds}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="keypad-container" style="background: #fff; position: absolute; bottom: 0; margin-bottom: 57px; width: 100%;">
|
||||
<div class="keypad" style="background: #f2f2f2; position: relative;">
|
||||
<div class="sendmax" ng-if="vm.availableFunds && !vm.isRequestingSpecificAmount">
|
||||
<button class="button button-sendmax" ng-click="vm.sendMax()">
|
||||
<span>
|
||||
<span translate>Use All Available Funds</span> 
|
||||
<span class="available-funds-amount">({{vm.availableFunds}})</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="keypad" style="position: relative;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col digit" ng-click="pushDigit('7')">7</div>
|
||||
<div class="col digit" ng-click="pushDigit('8')">8</div>
|
||||
<div class="col digit" ng-click="pushDigit('9')">9</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('7')">7</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('8')">8</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('9')">9</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col digit" ng-click="pushDigit('4')">4</div>
|
||||
<div class="col digit" ng-click="pushDigit('5')">5</div>
|
||||
<div class="col digit" ng-click="pushDigit('6')">6</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('4')">4</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('5')">5</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('6')">6</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col digit" ng-click="pushDigit('1')">1</div>
|
||||
<div class="col digit" ng-click="pushDigit('2')">2</div>
|
||||
<div class="col digit" ng-click="pushDigit('3')">3</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('1')">1</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('2')">2</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('3')">3</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col digit" ng-click="pushDigit('.')">.</div>
|
||||
<div class="col digit" ng-click="pushDigit('0')">0</div>
|
||||
<div class="col digit icon ion-backspace-outline" ng-click="removeDigit()"></div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('.')">.</div>
|
||||
<div class="col digit" ng-click="vm.pushDigit('0')">0</div>
|
||||
<div class="col digit icon ion-backspace-outline" ng-click="vm.removeDigit()"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="button button-full button-primary no-margin"
|
||||
ng-disabled="!allowSend"
|
||||
ng-click="finish()"
|
||||
ng-disabled="!vm.allowSend"
|
||||
ng-click="vm.finish()"
|
||||
style="position: absolute; bottom: 0;"
|
||||
translate>
|
||||
Next
|
||||
|
|
|
|||
4
www/views/includes/amount.html
Normal file
4
www/views/includes/amount.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<div class="amount"
|
||||
ng-class="{ 'size-equal': displaySizeEqual }">
|
||||
<span ng-if="start.length > 0" class="start">{{start}}</span><span ng-if="middle.length > 0" class="middle">{{middle}}</span><span ng-if="end.length > 0" class="end">{{end}}</span><span ng-if="currency.length > 0" class="currency">{{currency}}</span>
|
||||
</div>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="title">
|
||||
{{'Alternative Currency'|translate}}
|
||||
</div>
|
||||
<button class="button button-clear" ng-click="close()" translate>
|
||||
<button class="button button-clear" ng-click="vm.close()" translate>
|
||||
{{'Close'|translate}}
|
||||
</button>
|
||||
</ion-header-bar>
|
||||
|
|
@ -11,23 +11,23 @@
|
|||
<div class="bar bar-header item-input-inset m20b">
|
||||
<label class="item-input-wrapper">
|
||||
<i class="icon ion-ios-search placeholder-icon"></i>
|
||||
<input type="search" ng-init="searchedAltCurrency = ''" ng-model="searchedAltCurrency" ng-change="findCurrency(searchedAltCurrency)"
|
||||
<input type="search" ng-init="searchedAltCurrency = ''" ng-model="searchedAltCurrency" ng-change="vm.findCurrency(searchedAltCurrency)"
|
||||
placeholder="{{'Search your currency' | translate}}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="list" ng-if="lastUsedPopularList[0] && searchedAltCurrency.length == 0">
|
||||
<ion-radio class="alt-currency-radio" ng-repeat="lastUsedAltCurrency in lastUsedPopularList" ng-value="lastUsedAltCurrency.isoCode" ng-model="currentCurrency"
|
||||
ng-click="save(lastUsedAltCurrency)">{{lastUsedAltCurrency.name}} <span class="item-note">{{lastUsedAltCurrency.isoCode}}</span>
|
||||
<div class="list" ng-if="vm.lastUsedPopularList[0] && searchedAltCurrency.length == 0">
|
||||
<ion-radio class="alt-currency-radio" ng-repeat="lastUsedAltCurrency in vm.lastUsedPopularList" ng-value="lastUsedAltCurrency.isoCode" ng-model="currentCurrency"
|
||||
ng-click="vm.save(lastUsedAltCurrency)">{{lastUsedAltCurrency.name}} <span class="item-note">{{lastUsedAltCurrency.isoCode}}</span>
|
||||
</ion-radio>
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="item" ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"
|
||||
ng-click="save(altCurrency)">{{altCurrency.name}} <span class="item-note">{{altCurrency.isoCode}}</span>
|
||||
<div class="item" ng-repeat="altCurrency in vm.altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"
|
||||
ng-click="vm.save(altCurrency)">{{altCurrency.name}} <span class="item-note">{{altCurrency.isoCode}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<ion-infinite-scroll
|
||||
ng-if="!listComplete"
|
||||
on-infinite="loadMore()"
|
||||
ng-if="!vm.listComplete"
|
||||
on-infinite="vm.loadMore()"
|
||||
distance="50%">
|
||||
</ion-infinite-scroll>
|
||||
</ion-content>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue