Wallet to wallet flow
This commit is contained in:
parent
d8785f7928
commit
2e6ae9770e
4 changed files with 52 additions and 11 deletions
|
|
@ -4,6 +4,8 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
var clipboardHasAddress = false;
|
var clipboardHasAddress = false;
|
||||||
var clipboardHasContent = false;
|
var clipboardHasContent = false;
|
||||||
var originalList;
|
var originalList;
|
||||||
|
$scope.displayBalanceAsFiat = true;
|
||||||
|
$scope.walletSelectorTitleForce = true;
|
||||||
|
|
||||||
$scope.addContact = function() {
|
$scope.addContact = function() {
|
||||||
$state.go('tabs.settings').then(function() {
|
$state.go('tabs.settings').then(function() {
|
||||||
|
|
@ -50,22 +52,25 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var wallets;
|
||||||
|
var walletsBch;
|
||||||
|
var walletsBtc;
|
||||||
var walletToWalletFrom = false;
|
var walletToWalletFrom = false;
|
||||||
var walletToWalletTo = false;
|
|
||||||
|
|
||||||
$scope.onWalletSelect = function(wallet) {
|
$scope.onWalletSelect = function(wallet) {
|
||||||
if (!$scope.walletToWalletFrom) {
|
if (!$scope.walletToWalletFrom) {
|
||||||
$scope.walletToWalletFrom = wallet;
|
$scope.walletToWalletFrom = wallet;
|
||||||
$scope.walletSelectorTitle = gettextCatalog.getString('Send to');
|
if (wallet.coin === 'bch') {
|
||||||
$timeout(function(){
|
$scope.showWalletsBch = true;
|
||||||
$scope.showWallets = true;
|
} else if (wallet.coin === 'btc') {
|
||||||
}, 200);
|
$scope.showWalletsBtc = true;
|
||||||
|
}
|
||||||
|
$scope.walletSelectorTitleTo = gettextCatalog.getString('Send to');
|
||||||
} else {
|
} else {
|
||||||
$scope.walletToWalletTo = wallet;
|
walletService.getAddress(wallet, true, function(err, addr) {
|
||||||
walletService.getAddress($scope.walletToWalletFrom, true, function(err, addr) {
|
|
||||||
return $state.transitionTo('tabs.send.amount', {
|
return $state.transitionTo('tabs.send.amount', {
|
||||||
displayAddress: $scope.walletToWalletFrom.coin === 'bch' ? bitcoinCashJsService.translateAddresses(addr).cashaddr : addr,
|
displayAddress: $scope.walletToWalletFrom.coin === 'bch' ? bitcoinCashJsService.translateAddresses(addr).cashaddr : addr,
|
||||||
|
recipientType: 'wallet',
|
||||||
fromWalletId: $scope.walletToWalletFrom.walletId,
|
fromWalletId: $scope.walletToWalletFrom.walletId,
|
||||||
toAddress: addr,
|
toAddress: addr,
|
||||||
coin: $scope.walletToWalletFrom.coin
|
coin: $scope.walletToWalletFrom.coin
|
||||||
|
|
@ -77,7 +82,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
|
|
||||||
$scope.showWalletSelector = function() {
|
$scope.showWalletSelector = function() {
|
||||||
$scope.walletToWalletFrom = false;
|
$scope.walletToWalletFrom = false;
|
||||||
$scope.walletSelectorTitle = gettextCatalog.getString('Send from');
|
$scope.walletSelectorTitleFrom = gettextCatalog.getString('Send from');
|
||||||
$scope.showWallets = true;
|
$scope.showWallets = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -107,6 +112,14 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
$scope.wallets = profileService.getWallets({
|
$scope.wallets = profileService.getWallets({
|
||||||
onlyComplete: true
|
onlyComplete: true
|
||||||
});
|
});
|
||||||
|
$scope.walletsBch = profileService.getWallets({
|
||||||
|
onlyComplete: true,
|
||||||
|
coin: 'bch'
|
||||||
|
});
|
||||||
|
$scope.walletsBtc = profileService.getWallets({
|
||||||
|
onlyComplete: true,
|
||||||
|
coin: 'btc'
|
||||||
|
});
|
||||||
$scope.hasWallets = lodash.isEmpty($scope.wallets) ? false : true;
|
$scope.hasWallets = lodash.isEmpty($scope.wallets) ? false : true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -234,11 +247,19 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
|
$scope.showWalletsBch = $scope.showWalletsBtc = $scope.showWallets = false;
|
||||||
|
|
||||||
$scope.checkingBalance = true;
|
$scope.checkingBalance = true;
|
||||||
$scope.formData = {
|
$scope.formData = {
|
||||||
search: null
|
search: null
|
||||||
};
|
};
|
||||||
originalList = [];
|
originalList = [];
|
||||||
hasWallets();
|
hasWallets();
|
||||||
|
|
||||||
|
configService.whenAvailable(function(_config) {
|
||||||
|
$scope.displayBalanceAsFiat = _config.wallet.settings.priceDisplay === 'fiat';
|
||||||
|
config = _config;
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ angular.module('copayApp.directives')
|
||||||
transclude: true,
|
transclude: true,
|
||||||
scope: {
|
scope: {
|
||||||
title: '=walletSelectorTitle',
|
title: '=walletSelectorTitle',
|
||||||
|
forceTitle: '=walletSelectorForceTitle',
|
||||||
show: '=walletSelectorShow',
|
show: '=walletSelectorShow',
|
||||||
wallets: '=walletSelectorWallets',
|
wallets: '=walletSelectorWallets',
|
||||||
selectedWallet: '=walletSelectorSelectedWallet',
|
selectedWallet: '=walletSelectorSelectedWallet',
|
||||||
|
|
@ -15,6 +16,7 @@ angular.module('copayApp.directives')
|
||||||
displayBalanceAsFiat : '=walletSelectorDisplayBalanceAsFiat'
|
displayBalanceAsFiat : '=walletSelectorDisplayBalanceAsFiat'
|
||||||
},
|
},
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
|
console.log(scope, element, attrs);
|
||||||
scope.hide = function() {
|
scope.hide = function() {
|
||||||
scope.show = false;
|
scope.show = false;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
ng-init="wallet.coin == 'btc' ? walletsBtc.push(wallet) : walletsBch.push(wallet)">
|
ng-init="wallet.coin == 'btc' ? walletsBtc.push(wallet) : walletsBch.push(wallet)">
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="header" ng-if="!walletsBtc[0] || !walletsBch[0]">{{title}}</div>
|
<div class="header" ng-if="(!walletsBtc[0] || !walletsBch[0]) || forceTitle === true">{{title}}</div>
|
||||||
|
|
||||||
<div class="subheader" ng-if="walletsBch[0] && walletsBtc[0]">
|
<div class="subheader" ng-if="walletsBch[0] && walletsBtc[0]">
|
||||||
<div translate>Bitcoin Cash (BCH)</div>
|
<div translate>Bitcoin Cash (BCH)</div>
|
||||||
|
|
|
||||||
|
|
@ -115,11 +115,29 @@
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
<wallet-selector
|
<wallet-selector
|
||||||
wallet-selector-title="walletSelectorTitle"
|
wallet-selector-title="walletSelectorTitleFrom"
|
||||||
|
wallet-selector-force-title="walletSelectorTitleForce"
|
||||||
wallet-selector-wallets="wallets"
|
wallet-selector-wallets="wallets"
|
||||||
wallet-selector-selected-wallet="wallet"
|
wallet-selector-selected-wallet="wallet"
|
||||||
wallet-selector-show="showWallets"
|
wallet-selector-show="showWallets"
|
||||||
wallet-selector-on-select="onWalletSelect"
|
wallet-selector-on-select="onWalletSelect"
|
||||||
wallet-selector-display-balance-as-fiat="displayBalanceAsFiat">
|
wallet-selector-display-balance-as-fiat="displayBalanceAsFiat">
|
||||||
</wallet-selector>
|
</wallet-selector>
|
||||||
|
<wallet-selector
|
||||||
|
wallet-selector-title="walletSelectorTitleTo"
|
||||||
|
wallet-selector-wallets="walletsBch"
|
||||||
|
wallet-selector-selected-wallet="wallet"
|
||||||
|
wallet-selector-show="showWalletsBch"
|
||||||
|
wallet-selector-on-select="onWalletSelect"
|
||||||
|
wallet-selector-display-balance-as-fiat="displayBalanceAsFiat">
|
||||||
|
</wallet-selector>
|
||||||
|
<wallet-selector
|
||||||
|
wallet-selector-title="walletSelectorTitleTo"
|
||||||
|
wallet-selector-wallets="walletsBtc"
|
||||||
|
wallet-selector-selected-wallet="wallet"
|
||||||
|
wallet-selector-show="showWalletsBtc"
|
||||||
|
wallet-selector-on-select="onWalletSelect"
|
||||||
|
wallet-selector-display-balance-as-fiat="displayBalanceAsFiat">
|
||||||
|
</wallet-selector>
|
||||||
|
|
||||||
</ion-view>
|
</ion-view>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue