From 4231dcadc7bbeaa1001c6682cfb83fbff18c2364 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 23 Aug 2016 15:13:51 -0300 Subject: [PATCH] fix address generate --- public/views/tab-receive.html | 25 +++------------------ public/views/tab-settings.html | 1 - src/js/controllers/tab-receive.js | 37 ++++--------------------------- src/js/directives/directives.js | 3 +-- 4 files changed, 8 insertions(+), 58 deletions(-) diff --git a/public/views/tab-receive.html b/public/views/tab-receive.html index 7e338b681..f9aaf7d89 100644 --- a/public/views/tab-receive.html +++ b/public/views/tab-receive.html @@ -44,7 +44,7 @@ Error: {{addrError}} Share address -
+
Next Address
@@ -54,27 +54,8 @@ Error: {{addrError}} {{addr}}
- - + + diff --git a/public/views/tab-settings.html b/public/views/tab-settings.html index 4549569dd..7783fad68 100644 --- a/public/views/tab-settings.html +++ b/public/views/tab-settings.html @@ -18,7 +18,6 @@
Preferences
-
diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index d46bd1e69..01471d553 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -5,37 +5,14 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi $scope.isCordova = platformInfo.isCordova; $scope.init = function() { - $scope.index = 0; + $scope.defaultWallet = profileService.getWallets()[0]; $scope.isCordova = platformInfo.isCordova; $scope.isNW = platformInfo.isNW; - // $scope.setWallets(); $scope.setAddress(false); - // $scope.options = { - // loop: false, - // effect: 'flip', - // speed: 500, - // spaceBetween: 100 - // } - // - // $scope.$on("$ionicSlides.sliderInitialized", function(event, data) { - // // data.slider is the instance of Swiper - // $scope.slider = data.slider; - // }); - // - // $scope.$on("$ionicSlides.slideChangeStart", function(event, data) { - // console.log('Slide change is beginning'); - // }); - // - // $scope.$on("$ionicSlides.slideChangeEnd", function(event, data) { - // $scope.index = data.slider.activeIndex; - // $scope.setAddress(); - // }); } $scope.copyToClipboard = function(addr, $event) { - var showPopover = function() { - $ionicPopover.fromTemplateUrl('views/includes/copyToClipboard.html', { scope: $scope }).then(function(popover) { @@ -66,8 +43,8 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi }; $scope.$on('Wallet/Changed', function(event, wallet) { - console.log(wallet); $log.debug('Wallet changed: ' + wallet.name); + $scope.defaultWallet = wallet; $scope.setAddress(wallet); }); @@ -78,13 +55,13 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi }; $scope.setAddress = function(wallet, forceNew) { - if (!wallet) return; + var wallet = wallet || $scope.defaultWallet; if ($scope.generatingAddress) return; $scope.addr = null; $scope.addrError = null; - if (!wallet.isComplete()) { + if (wallet && !wallet.isComplete()) { $scope.incomplete = true; $timeout(function() { $scope.$digest(); @@ -108,10 +85,4 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi }); }); }; - - - $scope.setWallets = function() { - $scope.wallets = profileService.getWallets(); - }; - }); diff --git a/src/js/directives/directives.js b/src/js/directives/directives.js index 945511b1e..513be5ea4 100644 --- a/src/js/directives/directives.js +++ b/src/js/directives/directives.js @@ -159,8 +159,7 @@ angular.module('copayApp.directives') scope.$on("$ionicSlides.sliderInitialized", function(event, data) { scope.slider = data.slider; - scope.content.index = data.slider.activeIndex; - scope.$emit('Wallet/Changed', scope.content.wallets[scope.content.index]); + scope.$emit('Wallet/Changed', scope.content.wallets[0]); }); scope.$on("$ionicSlides.slideChangeEnd", function(event, data) {