diff --git a/i18n/po/template.pot b/i18n/po/template.pot index df01cecec..10656ae42 100644 --- a/i18n/po/template.pot +++ b/i18n/po/template.pot @@ -3112,6 +3112,10 @@ msgstr "" msgid "Top up {{amountStr}} to debit card ({{cardLastNumber}})" msgstr "" +#: www/views/shapeshift.html:30 +msgid "Start ShapeShift" +msgstr "" + #: www/views/buyAmazon.html:61 #: www/views/buyMercadoLibre.html:60 #: www/views/modals/wallet-balance.html:23 diff --git a/src/js/controllers/shapeshift.js b/src/js/controllers/shapeshift.js index 5bc815d19..8e991c5b4 100644 --- a/src/js/controllers/shapeshift.js +++ b/src/js/controllers/shapeshift.js @@ -1,10 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('shapeshiftController', function($scope, $interval, profileService, walletService, popupService, lodash, $ionicNavBarDelegate) { - var vm = this; - - //vm.buyBitcion = buyBitcoin; - +angular.module('copayApp.controllers').controller('shapeshiftController', function($scope, $state, $interval, profileService, walletService, popupService, lodash, $ionicNavBarDelegate) { var walletsBtc = []; var walletsBch = []; @@ -19,59 +15,51 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi } function showToWallets() { - $scope.toWallets = $scope.fromWallet.coin == 'btc' ? walletsBch : walletsBtc; + $scope.toWallets = $scope.fromWallet.coin === 'btc' ? walletsBch : walletsBtc; $scope.onToWalletSelect($scope.toWallets[0]); - $scope.singleToWallet = $scope.toWallets.length == 1; + $scope.singleToWallet = $scope.toWallets.length === 1; } - function buyBitcoin() { - console.log('buyBitcoin()'); - } - - $scope.buyBitcoin = buyBitcoin; - - $scope.onFromWalletSelect = function(wallet) { - $scope.fromWallet = wallet; - showToWallets(); - generateAddress(wallet, function(addr) { - $scope.fromWalletAddress = addr; - }); - }; - - $scope.onToWalletSelect = function(wallet) { - $scope.toWallet = wallet; - generateAddress(wallet, function(addr) { - $scope.toWalletAddress = addr; - }); - } + // $scope.onFromWalletSelect = function(wallet) { + // $scope.fromWallet = wallet; + // showToWallets(); + // generateAddress(wallet, function(addr) { + // $scope.fromWalletAddress = addr; + // }); + // }; + // + // $scope.onToWalletSelect = function(wallet) { + // $scope.toWallet = wallet; + // generateAddress(wallet, function(addr) { + // $scope.toWalletAddress = addr; + // }); + // }; $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; }); - 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; - $scope.singleToWallet = $scope.toWallets.length == 1; + + if ($scope.fromWallets.length === 0) { + // return + // } else { + // $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; + $scope.walletsWithFunds = profileService.getWallets({onlyComplete: true, hasFunds: true}); + console.log($scope.walletsWithFunds); + $scope.wallets = profileService.getWallets({onlyComplete: true}); + $scope.hasWallets = !lodash.isEmpty($scope.wallets); }); $scope.$on("$ionicView.enter", function(event, data) { @@ -80,9 +68,33 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi $scope.showFromWalletSelector = function() { $scope.showFromWallets = true; - } + }; $scope.showToWalletSelector = function() { $scope.showToWallets = true; + }; + + // This could probably be enhanced refactoring the routes abstract states + $scope.createWallet = function() { + $state.go('tabs.home').then(function() { + $state.go('tabs.add.create-personal'); + }); + }; + + $scope.buyBitcoin = function() { + $state.go('tabs.home').then(function() { + $state.go('tabs.buyandsell'); + }); + }; + + $scope.shapeshift = function() { + var params = { + thirdParty: { + id: 'shapeshift' + } + }; + $state.go('tabs.home').then(function() { + $state.transitionTo('tabs.send', params); + }); } }); diff --git a/src/js/controllers/sendFlowController.js b/src/js/controllers/walletSelectorController.js similarity index 94% rename from src/js/controllers/sendFlowController.js rename to src/js/controllers/walletSelectorController.js index a6965bd96..7f5519452 100644 --- a/src/js/controllers/sendFlowController.js +++ b/src/js/controllers/walletSelectorController.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('sendFlowController', function($scope, $rootScope, $state, $stateParams, $log, $ionicHistory, configService, gettextCatalog, profileService) { +angular.module('copayApp.controllers').controller('walletSelectorController', function($scope, $rootScope, $state, $stateParams, $log, $ionicHistory, configService, gettextCatalog, profileService) { $scope.$on("$ionicView.beforeEnter", function(event, data) { var config = configService.getSync().wallet.settings; diff --git a/src/js/routes.js b/src/js/routes.js index 0fa92750e..f7641b545 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -299,7 +299,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/wallet-to-wallet', views: { 'tab-send@tabs': { - controller: 'sendFlowController', + controller: 'walletSelectorController', templateUrl: 'views/wallet-origin-destination.html' } } @@ -308,7 +308,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/origin/:thirdParty/:amount/:toAddress/:toWalletId/:coin', views: { 'tab-send@tabs': { - controller: 'sendFlowController', + controller: 'walletSelectorController', templateUrl: 'views/wallet-origin-destination.html', } } @@ -317,7 +317,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/destination/:thirdParty/:amount/:fromWalletId', views: { 'tab-send@tabs': { - controller: 'sendFlowController', + controller: 'walletSelectorController', templateUrl: 'views/wallet-origin-destination.html', } } diff --git a/src/sass/mixins/layout.scss b/src/sass/mixins/layout.scss index b03d53800..e03a735fa 100644 --- a/src/sass/mixins/layout.scss +++ b/src/sass/mixins/layout.scss @@ -18,3 +18,42 @@ .absolute-center{ @include absolute-center(); } + +@mixin empty-case() { + padding-top: 5vh; + text-align: center; + .item { + border-style: none; + } + & > .title { + font-size: 20px; + color: $v-dark-gray; + margin: 20px 10px; + } + & > .subtitle { + font-size: 1rem; + line-height: 1.5em; + font-weight: 300; + color: #6F6F70; + margin: 20px 1em 2.5em; + } + .big-icon-svg { + .bg.green { + padding: 0 10px; + box-shadow: none; + } + } + .buttons { + margin-top: 18px; + .button { + font-weight: bold; + font-size: 19px; + } + } + .button-first-contact img { + height: 19px; + width: 19px; + margin-right: 6px; + vertical-align: sub; + } +} \ No newline at end of file diff --git a/src/sass/views/shapeshift.scss b/src/sass/views/shapeshift.scss new file mode 100644 index 000000000..8b4b941ab --- /dev/null +++ b/src/sass/views/shapeshift.scss @@ -0,0 +1,14 @@ +#shapeshift { + .empty-case { + @include empty-case(); + } + .button-shapeshift { + @extend %button-standard; + + @include button-style(#243F5D, #FFF, #606060, #FFF, #FFF); + @include button-clear(#FFF); + @include button-outline(#C1C1C1); + border: 0px; + @include button-shadow(); + } +} \ No newline at end of file diff --git a/src/sass/views/tab-send.scss b/src/sass/views/tab-send.scss index a4025156f..4fbe8e531 100644 --- a/src/sass/views/tab-send.scss +++ b/src/sass/views/tab-send.scss @@ -133,42 +133,7 @@ padding-left: 30px; } .sendTip { - padding-top: 5vh; - text-align: center; - .item { - border-style: none; - } - & > .title { - font-size: 20px; - color: $v-dark-gray; - margin: 20px 10px; - } - & > .subtitle { - font-size: 1rem; - line-height: 1.5em; - font-weight: 300; - color: #6F6F70; - margin: 20px 1em 2.5em; - } - .big-icon-svg { - .bg.green { - padding: 0 10px; - box-shadow: none; - } - } - .buttons { - margin-top: 18px; - .button { - font-weight: bold; - font-size: 19px; - } - } - .button-first-contact img { - height: 19px; - width: 19px; - margin-right: 6px; - vertical-align: sub; - } + @include empty-case(); } .item-heading { line-height: 16px; diff --git a/src/sass/views/views.scss b/src/sass/views/views.scss index e1a122dbb..700a45b62 100644 --- a/src/sass/views/views.scss +++ b/src/sass/views/views.scss @@ -14,6 +14,7 @@ @import "walletBalance"; @import "walletDetails"; @import "advancedSettings"; +@import "shapeshift"; @import "bitpayCard"; @import "bitpayCardIntro"; @import "buyandsell"; diff --git a/www/views/shapeshift.html b/www/views/shapeshift.html index 48664ebba..6a0a0e4e2 100644 --- a/www/views/shapeshift.html +++ b/www/views/shapeshift.html @@ -1,4 +1,4 @@ - + {{'Shapeshift'|translate}} @@ -10,107 +10,121 @@
-
-
- No available wallets to convert between. - - +
+
+ Your Bitcoin wallet is empty +
+
+
+

Before exchanging your BTC to BCH, you will need to add funds to your wallet.

+

You can receive Bitcoin from any wallet or service.

+
+
+

Using Shapeshift will allow you to exchange your BTC for BCH.

+

The process is fast and you will receive the exchanged amount in your wallet.

+
+
To get started, you'll need to create a bitcoin wallet and get some bitcoin.
+
+ + + +
- - + + + + + + + + + + + + + + - - -
- - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + - - - + + + + + + + + +