Merge remote-tracking branch 'origin/wallet/task/466' into wallet/task/454

This commit is contained in:
Sebastiaan Pasma 2018-07-30 22:17:56 +02:00
commit 9b27cb50e2
No known key found for this signature in database
GPG key ID: 9A2B0C8B95A1D26F
2 changed files with 24 additions and 1 deletions

View file

@ -1,6 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('shapeshiftController', function($scope, $interval, profileService, walletService, popupService, lodash, $ionicNavBarDelegate) {
var vm = this;
//vm.buyBitcion = buyBitcoin;
var walletsBtc = [];
var walletsBch = [];
@ -21,6 +24,12 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi
$scope.singleToWallet = $scope.toWallets.length == 1;
}
function buyBitcoin() {
console.log('buyBitcoin()');
}
$scope.buyBitcoin = buyBitcoin;
$scope.onFromWalletSelect = function(wallet) {
$scope.fromWallet = wallet;
showToWallets();
@ -37,12 +46,24 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi
}
$scope.$on("$ionicView.beforeEnter", function(event, data) {
console.log('beforeEnter()');
walletsBtc = profileService.getWallets({coin: 'btc'});
walletsBch = profileService.getWallets({coin: 'bch'});
$scope.fromWallets = lodash.filter(walletsBtc.concat(walletsBch), function(w) {
return w.status.balance.availableAmount > 0;
});
if ($scope.fromWallets.length == 0) return;
console.log('Checking wallets.');
if ($scope.fromWallets.length == 0) {
// Need to go to new origin screen here, with parameters
var params = {
thirdParty: {
id: 'shapeshift'
}
};
console.log('Asking for transition');
$state.transitionTo('tabs.send', params);
return
}
$scope.onFromWalletSelect($scope.fromWallets[0]);
$scope.onToWalletSelect($scope.toWallets[0]);
$scope.singleFromWallet = $scope.fromWallets.length == 1;

View file

@ -13,6 +13,8 @@
<div class="list card ng-hide" ng-show="fromWallets.length == 0 || toWallets.length == 0">
<div class="item item-heading">
<span translate>No available wallets to convert between.</span>
<button ui-sref="tabs.buyandsell">Buy Bitcoin Now</button>
<button ui-sref="tabs.receive">Show my address</button>
</div>
</div>
<shapeshift-coin-trader class="ng-hide" ng-show="fromWallets.length > 0 && toWallets.length > 0">