From 1689470fecdc86eacdee730e0442ecd10cb7f5f2 Mon Sep 17 00:00:00 2001 From: Kadir Sekha Date: Thu, 14 Dec 2017 13:26:58 +0900 Subject: [PATCH] shapeshift shows message if no available wallet to send from --- src/js/controllers/shapeshift.js | 10 ++- www/views/shapeshift.html | 150 ++++++++++++++++--------------- 2 files changed, 84 insertions(+), 76 deletions(-) diff --git a/src/js/controllers/shapeshift.js b/src/js/controllers/shapeshift.js index 2d43c0ec1..fa448447c 100644 --- a/src/js/controllers/shapeshift.js +++ b/src/js/controllers/shapeshift.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('shapeshiftController', function($scope, $interval, profileService, walletService, popupService) { +angular.module('copayApp.controllers').controller('shapeshiftController', function($scope, $interval, profileService, walletService, popupService, lodash) { var walletsBtc = []; var walletsBch = []; @@ -39,13 +39,15 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi $scope.$on("$ionicView.beforeEnter", function(event, data) { walletsBtc = profileService.getWallets({coin: 'btc'}); walletsBch = profileService.getWallets({coin: 'bch'}); - $scope.fromWallets = walletsBtc.concat(walletsBch); - $scope.toWallets = walletsBch; - if ($scope.fromWallets.length == 0 || $scope.toWallets.length == 0) return; + $scope.fromWallets = lodash.filter(walletsBtc.concat(walletsBch), function(w) { + return w.status.balance.availableAmount > 0; + }); + if ($scope.fromWallets.length == 0) return; $scope.onFromWalletSelect($scope.fromWallets[0]); $scope.onToWalletSelect($scope.toWallets[0]); $scope.singleFromWallet = $scope.fromWallets.length == 1; $scope.singleToWallet = $scope.toWallets.length == 1; + $scope.fromWalletSelectorTitle = 'From'; $scope.toWalletSelectorTitle = 'To'; $scope.showFromWallets = false; $scope.showToWallets = false; diff --git a/www/views/shapeshift.html b/www/views/shapeshift.html index 0ed4e4e63..cb4c900b7 100644 --- a/www/views/shapeshift.html +++ b/www/views/shapeshift.html @@ -7,21 +7,26 @@ - -