Ref confirm. Removes unused code. Fix noLowFee directive
This commit is contained in:
parent
13b8b81e11
commit
748e8a4fbb
11 changed files with 50 additions and 118 deletions
|
|
@ -176,12 +176,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
function getTxp(tx, wallet, dryRun, cb) {
|
||||
|
||||
var paypro = tx.paypro;
|
||||
var toAddress = tx.toAddress;
|
||||
var description = tx.description;
|
||||
|
||||
// ToDo: use a credential's (or fc's) function for this
|
||||
if (description && !wallet.credentials.sharedEncryptingKey) {
|
||||
if (tx.description && !wallet.credentials.sharedEncryptingKey) {
|
||||
var msg = gettextCatalog.getString('Could not add message to imported wallet without shared encrypting key');
|
||||
$log.warn(msg);
|
||||
return setSendError(msg);
|
||||
|
|
@ -208,7 +204,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
txp.feeLevel = tx.feeLevel;
|
||||
}
|
||||
|
||||
txp.message = description;
|
||||
txp.message = tx.description;
|
||||
|
||||
if (tx.paypro) {
|
||||
txp.payProUrl = tx.paypro.url;
|
||||
|
|
@ -254,7 +250,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
tx.feeLevelName = feeService.feeOpts[tx.feeLevel];
|
||||
|
||||
// End of quick refresh, before wallet is selected.
|
||||
if (!wallet)
|
||||
if (!wallet)
|
||||
return cb();
|
||||
|
||||
getSendMaxInfo(lodash.clone(tx), wallet, function(err, sendMaxInfo) {
|
||||
|
|
@ -276,6 +272,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
tx.sendMaxInfo = sendMaxInfo;
|
||||
tx.toAmount = tx.sendMaxInfo.amount;
|
||||
updateAmount();
|
||||
showSendMaxWarning(sendMaxInfo);
|
||||
}
|
||||
refresh();
|
||||
|
||||
|
|
@ -286,9 +283,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
getTxp(lodash.clone(tx), wallet, opts.dryRun, function(err, txp) {
|
||||
if (err) return cb(err);
|
||||
|
||||
if (tx.sendMaxInfo)
|
||||
showSendMaxWarning(sendMaxInfo, function(err) {});
|
||||
|
||||
txp.feeStr = txFormatService.formatAmountStr(txp.fee);
|
||||
txFormatService.formatAlternativeStr(txp.fee, function(v) {
|
||||
txp.alternativeFeeStr = v;
|
||||
|
|
@ -360,24 +354,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
popupService.showAlert(null, msg, function() {});
|
||||
};
|
||||
|
||||
function setSendMaxValues(data) {
|
||||
$scope.amountStr = txFormatService.formatAmountStr(data.amount, true);
|
||||
$scope.displayAmount = getDisplayAmount($scope.amountStr);
|
||||
$scope.displayUnit = getDisplayUnit($scope.amountStr);
|
||||
$scope.fee = txFormatService.formatAmountStr(data.fee);
|
||||
txFormatService.formatAlternativeStr(data.fee, function(v) {
|
||||
$scope.feeFiat = v;
|
||||
});
|
||||
toAmount = parseFloat((data.amount * satToUnit).toFixed(unitDecimals));
|
||||
txFormatService.formatAlternativeStr(data.amount, function(v) {
|
||||
$scope.alternativeAmountStr = v;
|
||||
});
|
||||
$scope.feeRateStr = (data.fee / (data.amount + data.fee) * 100).toFixed(2) + '%';
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on('accepted', function(event) {
|
||||
$scope.approve();
|
||||
});
|
||||
|
|
@ -565,27 +541,19 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
};
|
||||
|
||||
$scope.onSuccessConfirm = function() {
|
||||
var previousView = $ionicHistory.viewHistory().backView && $ionicHistory.viewHistory().backView.stateName;
|
||||
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$ionicHistory.removeBackView();
|
||||
$scope.sendStatus = '';
|
||||
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true,
|
||||
historyRoot: true
|
||||
});
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.send').then(function() {
|
||||
$ionicHistory.clearHistory();
|
||||
$state.transitionTo('tabs.home');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.chooseFeeLevel = function(tx, wallet) {
|
||||
|
||||
|
||||
var scope = $rootScope.$new(true);
|
||||
scope.network = tx.network;
|
||||
scope.feeLevel = tx.feeLevel;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ angular.module('copayApp.directives')
|
|||
|
||||
elem.bind('click', function() {
|
||||
configService.whenAvailable(function(config) {
|
||||
if (config.wallet.settings.feeLevel.match(/conomy/)) {
|
||||
if (config.wallet.settings.feeLevel && config.wallet.settings.feeLevel.match(/conomy/)) {
|
||||
$log.debug('Economy Fee setting... disabling link:' + elem.text());
|
||||
popupService.showAlert('Low Fee Error', 'Please change your Bitcoin Network Fee Policy setting to Normal or higher to use this service', function() {
|
||||
$ionicHistory.goBack();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ angular.module('copayApp.directives')
|
|||
scope: {
|
||||
sendStatus: '=slideSendStatus',
|
||||
onConfirm: '&slideOnConfirm',
|
||||
wallet: '=hasWalletChosen'
|
||||
isDisabled: '=isDisabled'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue