Merge pull request #635 from cmgustavo/bug/wallet-details-tx-list

Preload the address book on wallet-details
This commit is contained in:
Matias Alejo Garcia 2016-10-21 14:06:32 -03:00 committed by GitHub
commit c689d4eb13
3 changed files with 22 additions and 27 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, profileService, lodash, configService, gettextCatalog, platformInfo, walletService, txpModalService, externalLinkService, popupService) {
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, profileService, lodash, configService, gettextCatalog, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService) {
var HISTORY_SHOW_LIMIT = 10;
var currentTxHistoryPage = 0;
@ -184,6 +184,11 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
$scope.requiresMultipleSignatures = $scope.wallet.credentials.m > 1;
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
$scope.addressbook = ab || {};
});
$scope.updateAll();
listeners = [

View file

@ -113,13 +113,10 @@ angular.module('copayApp.directives')
}
}
})
.directive('contact', ['addressbookService', 'lodash', 'gettextCatalog',
function(addressbookService, lodash, gettextCatalog) {
.directive('contact', ['addressbookService', 'lodash',
function(addressbookService, lodash) {
return {
restrict: 'E',
scope: {
label: '='
},
link: function(scope, element, attrs) {
var addr = attrs.address;
addressbookService.get(addr, function(err, ab) {
@ -127,11 +124,7 @@ angular.module('copayApp.directives')
var name = lodash.isObject(ab) ? ab.name : ab;
element.append(name);
} else {
if (scope.label && scope.label == 'Sent') {
element.append(gettextCatalog.getString('Sent'));
} else {
element.append(addr);
}
element.append(addr);
}
});
}