commit
30b23d0358
5 changed files with 151 additions and 98 deletions
|
|
@ -24,9 +24,9 @@
|
|||
"windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c",
|
||||
"pushSenderId": "1036948132229",
|
||||
"description": "A Secure Bitcoin Wallet",
|
||||
"version": "5.1.5",
|
||||
"fullVersion": "5.1-rc4",
|
||||
"androidVersion": "501500",
|
||||
"version": "5.1.6",
|
||||
"fullVersion": "5.1-rc5",
|
||||
"androidVersion": "501600",
|
||||
"_extraCSS": "",
|
||||
"_enabledExtensions": {
|
||||
"coinbase": false,
|
||||
|
|
|
|||
|
|
@ -8,31 +8,7 @@ angular
|
|||
|
||||
function amountController(configService, $filter, gettextCatalog, $ionicHistory, $ionicModal, $ionicScrollDelegate, lodash, $log, nodeWebkitService, rateService, $scope, $state, $timeout, sendFlowService, shapeshiftService, txFormatService, platformInfo, ongoingProcess, popupService, profileService, walletService, $window) {
|
||||
var vm = this;
|
||||
|
||||
// Variables
|
||||
vm.allowSend = false;
|
||||
vm.altCurrencyList = [];
|
||||
vm.alternativeAmount = '';
|
||||
vm.alternativeUnit = '';
|
||||
vm.amount = '0';
|
||||
vm.availableFunds = '';
|
||||
vm.canSendAllAvailableFunds = true;
|
||||
vm.errorMessage = '';
|
||||
// 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.isRequestingSpecificAmount = false;
|
||||
vm.listComplete = false;
|
||||
vm.lastUsedPopularList = [];
|
||||
vm.maxAmount = 0;
|
||||
vm.minAmount = 0;
|
||||
vm.sendableFunds = '';
|
||||
vm.showSendMaxButton = false;
|
||||
vm.showSendLimitMaxButton = false;
|
||||
vm.thirdParty = null;
|
||||
vm.unit = '';
|
||||
|
||||
|
||||
// Functions
|
||||
vm.changeUnit = changeUnit;
|
||||
vm.close = close;
|
||||
|
|
@ -46,7 +22,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
vm.removeDigit = removeDigit;
|
||||
vm.save = save;
|
||||
vm.sendMax = sendMax;
|
||||
|
||||
|
||||
$scope.$on('$ionicView.beforeEnter', onBeforeEnter);
|
||||
$scope.$on('$ionicView.leave', onLeave);
|
||||
|
|
@ -79,8 +54,55 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
satoshis: null
|
||||
};
|
||||
|
||||
function onLeave() {
|
||||
angular.element($window).off('keydown');
|
||||
function initVariables() {
|
||||
// Private variables
|
||||
altCurrencyModal = null;
|
||||
altUnitIndex = 0;
|
||||
availableUnits = [];
|
||||
canSendMax = true;
|
||||
fiatCode;
|
||||
isNW = platformInfo.isNW;
|
||||
isAndroid = platformInfo.isAndroid;
|
||||
isIos = platformInfo.isIOS;
|
||||
lastUsedAltCurrencyList = [];
|
||||
passthroughParams = {};
|
||||
satToUnit;
|
||||
transactionSendableAmount = {
|
||||
crypto: '',
|
||||
satoshis: null
|
||||
};
|
||||
unitDecimals;
|
||||
unitIndex = 0;
|
||||
unitToSatoshi;
|
||||
useSendMax = false;
|
||||
walletSpendableAmount = {
|
||||
crypto: '',
|
||||
satoshis: null
|
||||
};
|
||||
|
||||
// Public variables
|
||||
vm.allowSend = false;
|
||||
vm.altCurrencyList = [];
|
||||
vm.alternativeAmount = '';
|
||||
vm.alternativeUnit = '';
|
||||
vm.amount = '0';
|
||||
vm.availableFunds = '';
|
||||
vm.canSendAllAvailableFunds = true;
|
||||
vm.errorMessage = '';
|
||||
// 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.isRequestingSpecificAmount = false;
|
||||
vm.listComplete = false;
|
||||
vm.lastUsedPopularList = [];
|
||||
vm.maxAmount = 0;
|
||||
vm.minAmount = 0;
|
||||
vm.sendableFunds = '';
|
||||
vm.showSendMaxButton = false;
|
||||
vm.showSendLimitMaxButton = false;
|
||||
vm.thirdParty = null;
|
||||
vm.unit = '';
|
||||
}
|
||||
|
||||
function onBeforeEnter(event, data) {
|
||||
|
|
@ -89,12 +111,15 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Init before entering on this screen
|
||||
initVariables();
|
||||
initCurrencies();
|
||||
// Then start
|
||||
|
||||
passthroughParams = sendFlowService.state.getClone();
|
||||
console.log('amount onBeforeEnter after back sendflow ', passthroughParams);
|
||||
|
||||
|
||||
// Init thirdParty, should be done for all the variable
|
||||
vm.thirdParty = null;
|
||||
|
||||
|
|
@ -223,6 +248,10 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
}
|
||||
}
|
||||
|
||||
function onLeave() {
|
||||
angular.element($window).off('keydown');
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
sendFlowService.router.goBack();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,55 +9,6 @@ angular
|
|||
function reviewController(addressbookService, externalLinkService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, clipboardService, configService, feeService, gettextCatalog, $interval, $ionicHistory, $ionicModal, ionicToast, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, sendFlowService, shapeshiftService, soundService, $state, $timeout, txConfirmNotification, txFormatService, walletService) {
|
||||
var vm = this;
|
||||
|
||||
vm.buttonText = '';
|
||||
vm.destination = {
|
||||
address: '',
|
||||
balanceAmount: '',
|
||||
balanceCurrency: '',
|
||||
coin: '',
|
||||
color: '',
|
||||
currency: '',
|
||||
currencyColor: '',
|
||||
kind: '', // 'address', 'contact', 'wallet'
|
||||
name: ''
|
||||
};
|
||||
vm.displayAddress = '';
|
||||
vm.feeCrypto = '';
|
||||
vm.feeFiat = '';
|
||||
vm.fiatCurrency = '';
|
||||
vm.feeIsHigh = false;
|
||||
vm.feeLessThanACent = false;
|
||||
vm.isCordova = platformInfo.isCordova;
|
||||
vm.memo = '';
|
||||
vm.notReadyMessage = '';
|
||||
vm.origin = {
|
||||
balanceAmount: '',
|
||||
balanceCurrency: '',
|
||||
currency: '',
|
||||
currencyColor: '',
|
||||
};
|
||||
vm.originWallet = null;
|
||||
vm.paymentExpired = false;
|
||||
vm.personalNotePlaceholder = gettextCatalog.getString('Enter text here');
|
||||
vm.primaryAmount = '';
|
||||
vm.primaryCurrency = '';
|
||||
vm.usingMerchantFee = false;
|
||||
vm.readyToSend = false;
|
||||
vm.remainingTimeStr = '';
|
||||
vm.secondaryAmount = '';
|
||||
vm.secondaryCurrency = '';
|
||||
vm.sendingTitle = gettextCatalog.getString('You are sending');
|
||||
vm.sendStatus = '';
|
||||
vm.showAddress = true;
|
||||
vm.thirdParty = null;
|
||||
vm.wallet = null;
|
||||
vm.memoExpanded = false;
|
||||
|
||||
// Functions
|
||||
vm.goBack = goBack;
|
||||
vm.onSuccessConfirm = onSuccessConfirm;
|
||||
vm.onShareTransaction = onShareTransaction;
|
||||
|
||||
var sendFlowData;
|
||||
var config = null;
|
||||
var coin = '';
|
||||
|
|
@ -76,14 +27,85 @@ angular
|
|||
var unitFromSat = 0;
|
||||
|
||||
var FEE_TOO_HIGH_LIMIT_PERCENTAGE = 15;
|
||||
|
||||
// Functions
|
||||
vm.goBack = goBack;
|
||||
vm.onSuccessConfirm = onSuccessConfirm;
|
||||
vm.onShareTransaction = onShareTransaction;
|
||||
|
||||
function initVariables() {
|
||||
// Private variables
|
||||
sendFlowData;
|
||||
config = null;
|
||||
coin = '';
|
||||
countDown = null;
|
||||
defaults = {};
|
||||
usingCustomFee = false;
|
||||
usingMerchantFee = false;
|
||||
destinationWalletId = '';
|
||||
lastTxId = '';
|
||||
originWalletId = '';
|
||||
priceDisplayIsFiat = true;
|
||||
satoshis = null;
|
||||
toAddress = '';
|
||||
tx = {};
|
||||
txPayproData = null;
|
||||
unitFromSat = 0;
|
||||
|
||||
// Public variables
|
||||
vm.buttonText = '';
|
||||
vm.destination = {
|
||||
address: '',
|
||||
balanceAmount: '',
|
||||
balanceCurrency: '',
|
||||
coin: '',
|
||||
color: '',
|
||||
currency: '',
|
||||
currencyColor: '',
|
||||
kind: '', // 'address', 'contact', 'wallet'
|
||||
name: ''
|
||||
};
|
||||
vm.displayAddress = '';
|
||||
vm.feeCrypto = '';
|
||||
vm.feeFiat = '';
|
||||
vm.fiatCurrency = '';
|
||||
vm.feeIsHigh = false;
|
||||
vm.feeLessThanACent = false;
|
||||
vm.isCordova = platformInfo.isCordova;
|
||||
vm.memo = '';
|
||||
vm.notReadyMessage = '';
|
||||
vm.origin = {
|
||||
balanceAmount: '',
|
||||
balanceCurrency: '',
|
||||
currency: '',
|
||||
currencyColor: '',
|
||||
};
|
||||
vm.originWallet = null;
|
||||
vm.paymentExpired = false;
|
||||
vm.personalNotePlaceholder = gettextCatalog.getString('Enter text here');
|
||||
vm.primaryAmount = '';
|
||||
vm.primaryCurrency = '';
|
||||
vm.usingMerchantFee = false;
|
||||
vm.readyToSend = false;
|
||||
vm.remainingTimeStr = '';
|
||||
vm.secondaryAmount = '';
|
||||
vm.secondaryCurrency = '';
|
||||
vm.sendingTitle = gettextCatalog.getString('You are sending');
|
||||
vm.sendStatus = '';
|
||||
vm.showAddress = true;
|
||||
vm.thirdParty = null;
|
||||
vm.wallet = null;
|
||||
vm.memoExpanded = false;
|
||||
}
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", onBeforeEnter);
|
||||
|
||||
function onBeforeEnter(event, data) {
|
||||
$log.debug('reviewController onBeforeEnter sendflow ', sendFlowService.state);
|
||||
|
||||
// Reset from last time
|
||||
vm.thirdParty = null;
|
||||
// Init before entering on this screen
|
||||
initVariables();
|
||||
// Then start
|
||||
|
||||
defaults = configService.getDefaults();
|
||||
sendFlowData = sendFlowService.state.getClone();
|
||||
|
|
@ -727,20 +749,7 @@ angular
|
|||
$timeout(function onTimeout() {
|
||||
$scope.$apply();
|
||||
}, 10);
|
||||
|
||||
});
|
||||
|
||||
// setWalletSelector(tx.coin, tx.network, tx.amount, function(err) {
|
||||
// if (err) {
|
||||
// return exitWithError('Could not update wallets');
|
||||
// }
|
||||
//
|
||||
// if (vm.wallets.length > 1) {
|
||||
// vm.showWalletSelector();
|
||||
// } else if (vm.wallets.length) {
|
||||
// setWallet(vm.wallets[0], tx);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
function showSendMaxWarning(wallet, sendMaxInfo) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,17 @@ angular
|
|||
var unitDecimals = 0;
|
||||
var unitsFromSatoshis = 0;
|
||||
|
||||
//
|
||||
// Needs to migrate $scope to vm.
|
||||
//
|
||||
function initVariables() {
|
||||
// Private variables
|
||||
fromWalletId = '';
|
||||
priceDisplayAsFiat = false;
|
||||
unitDecimals = 0;
|
||||
unitsFromSatoshis = 0;
|
||||
}
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", onBeforeEnter);
|
||||
$scope.$on("$ionicView.enter", onEnter);
|
||||
|
||||
|
|
@ -20,6 +31,10 @@ angular
|
|||
sendFlowService.state.pop();
|
||||
}
|
||||
|
||||
// Init before entering on this screen
|
||||
initVariables();
|
||||
// Then start
|
||||
|
||||
$scope.params = sendFlowService.state.getClone();
|
||||
|
||||
console.log('walletSelector onBeforeEnter after back sendflow', $scope.params);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ angular.module('copayApp.directives')
|
|||
scope.type = "url";
|
||||
} else if (scope.data.parsed.publicAddress) {
|
||||
scope.type = "bitcoinAddress";
|
||||
var prefix = scope.data.parsed.isTestnet ? 'bchtest:' : 'bitcoincash:';
|
||||
scope.data.toAddress = (prefix + scope.data.parsed.publicAddress.cashAddr) || scope.data.parsed.publicAddress.legacy || scope.data.parsed.publicAddress.bitpay;
|
||||
var prefix = scope.data.coin === 'bch' ? (scope.data.parsed.isTestnet ? 'bchtest:' : 'bitcoincash:') : '';
|
||||
scope.data.toAddress = (scope.data.parsed.publicAddress.cashAddr ? prefix + scope.data.parsed.publicAddress.cashAddr : false) || scope.data.parsed.publicAddress.legacy || scope.data.parsed.publicAddress.bitpay;
|
||||
} else {
|
||||
scope.type = "text";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue