diff --git a/public/views/addressbook.view.html b/public/views/addressbook.view.html index 15022a146..00b19e76b 100644 --- a/public/views/addressbook.view.html +++ b/public/views/addressbook.view.html @@ -18,7 +18,7 @@

Name

{{addressbookEntry.name}} -
+

Email

{{addressbookEntry.email}}
diff --git a/src/js/controllers/addressbookView.js b/src/js/controllers/addressbookView.js index 3ff3f0f81..a87d23bec 100644 --- a/src/js/controllers/addressbookView.js +++ b/src/js/controllers/addressbookView.js @@ -2,27 +2,32 @@ angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory) { - var address = $stateParams.address; + $scope.$on("$ionicView.beforeEnter", function(event, data){ + var address = data.stateParams.address; - if (!address) { - $state.go('tabs.addressbook'); - return; - } - - addressbookService.get(address, function(err, obj) { - if (err) { - popupService.showAlert(err); + if (!address) { + $ionicHistory.back(); return; } - if (!lodash.isObject(obj)) { - var name = obj; - obj = { - 'name': name, - 'address': address, - 'email': '' - }; - } - $scope.addressbookEntry = obj; + + addressbookService.get(address, function(err, obj) { + if (err) { + popupService.showAlert(err); + return; + } + if (!lodash.isObject(obj)) { + var name = obj; + obj = { + 'name': name, + 'address': address, + 'email': '' + }; + } + $scope.addressbookEntry = obj; + $timeout(function() { + $scope.$apply(); + }); + }); }); $scope.sendTo = function() { diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index c3583249a..6e2aa8d37 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -3,10 +3,12 @@ angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) { var originalList; - var CONTACTS_SHOW_LIMIT = 10; - var currentContactsPage = 0; + var CONTACTS_SHOW_LIMIT; + var currentContactsPage; var updateList = function() { + CONTACTS_SHOW_LIMIT = 10; + currentContactsPage = 0; originalList = []; var wallets = profileService.getWallets({ @@ -15,16 +17,18 @@ angular.module('copayApp.controllers').controller('tabSendController', function( $scope.hasWallets = lodash.isEmpty(wallets) ? false : true; $scope.oneWallet = wallets.length == 1; - lodash.each(wallets, function(v) { - originalList.push({ - color: v.color, - name: v.name, - isWallet: true, - getAddress: function(cb) { - walletService.getAddress(v, false, cb); - }, + if (!$scope.oneWallet) { + lodash.each(wallets, function(v) { + originalList.push({ + color: v.color, + name: v.name, + isWallet: true, + getAddress: function(cb) { + walletService.getAddress(v, false, cb); + }, + }); }); - }); + } addressbookService.list(function(err, ab) { if (err) $log.error(err); @@ -50,7 +54,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function( $timeout(function() { $ionicScrollDelegate.resize(); $scope.$apply(); - }, 10); + }, 100); }); }; diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index ec1492ef9..52dd02e5a 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -1,13 +1,12 @@ 'use strict'; -angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) { +angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, uxLanguage, platformInfo, profileService, feeService, configService) { var updateConfig = function() { var config = configService.getSync(); var isCordova = platformInfo.isCordova; var isWP = platformInfo.isWP; - var isIOS = platformInfo.isIOS; $scope.usePushNotifications = isCordova && !isWP; @@ -22,13 +21,10 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct $scope.feeOpts = feeService.feeOpts; $scope.currentFeeLevel = feeService.getCurrentFeeLevel(); - $scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) { - return w.id != self.walletId; - }); $scope.wallets = profileService.getWallets(); }; - $scope.$on("$ionicView.enter", function(event, data) { + $scope.$on("$ionicView.beforeEnter", function(event, data) { updateConfig(); });