diff --git a/public/views/tab-send.html b/public/views/tab-send.html index d23a0731f..3ab5f5f6a 100644 --- a/public/views/tab-send.html +++ b/public/views/tab-send.html @@ -4,45 +4,47 @@ -
-
Recipient
- -
+
Recipient
+
Contacts - +
- + Add a Contact + - + {{item.name}} + +
+ Show more +
-
+
Transfer to Wallet
-
No Wallet
- + - {{item.name}} +
diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 18cafd1d1..45c56dd9b 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -1,8 +1,10 @@ 'use strict'; -angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, addressbookService, profileService, lodash, $state, walletService, incomingData) { +angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData) { var originalList; + var CONTACTS_SHOW_LIMIT = 10; + var currentContactsPage = 0; var updateList = function() { originalList = []; @@ -11,6 +13,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function( onlyComplete: true }); $scope.hasWallets = lodash.isEmpty(wallets) ? false : true; + $scope.oneWallet = wallets.length == 1; lodash.each(wallets, function(v) { originalList.push({ @@ -27,9 +30,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function( if (err) $log.error(err); $scope.hasContacts = lodash.isEmpty(ab) ? false : true; - var contacts = []; + var completeContacts = []; lodash.each(ab, function(v, k) { - contacts.push({ + completeContacts.push({ name: lodash.isObject(v) ? v.name : v, address: k, email: lodash.isObject(v) ? v.email : null, @@ -39,15 +42,23 @@ angular.module('copayApp.controllers').controller('tabSendController', function( }); }); + var contacts = completeContacts.slice(0, (currentContactsPage + 1) * CONTACTS_SHOW_LIMIT); + $scope.contactsShowMore = completeContacts.length > contacts.length; originalList = originalList.concat(contacts); $scope.list = lodash.clone(originalList); $timeout(function() { + $ionicScrollDelegate.resize(); $scope.$apply(); - }, 1); + }, 10); }); }; + $scope.showMore = function() { + currentContactsPage++; + updateList(); + }; + $scope.findContact = function(search) { if (incomingData.redir(search)) { diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index bb1e15084..d24364bad 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('copayApp.services') - .factory('profileService', function profileServiceFactory($rootScope, $timeout, $filter, $log, sjcl, lodash, storageService, bwcService, configService, pushNotificationsService, gettext, gettextCatalog, bwcError, uxLanguage, platformInfo, $ionicHistory, txFormatService, $state) { + .factory('profileService', function profileServiceFactory($rootScope, $timeout, $filter, $log, sjcl, lodash, storageService, bwcService, configService, pushNotificationsService, gettext, gettextCatalog, bwcError, uxLanguage, platformInfo, txFormatService, $state) { var isChromeApp = platformInfo.isChromeApp; diff --git a/src/sass/views/tab-send.scss b/src/sass/views/tab-send.scss index bc8664ec0..bd0f19a99 100644 --- a/src/sass/views/tab-send.scss +++ b/src/sass/views/tab-send.scss @@ -16,4 +16,11 @@ position: absolute; top: 10px; } + .show-more { + text-align: center; + padding: 20px; + font-size: 16px; + color: #387ef5; + font-weight: bold; + } }