adding infinite scroll to the search feature

This commit is contained in:
Gabriel Bazán 2016-05-24 14:10:53 -03:00 committed by Javier
parent 5413e87f09
commit f2e1a8993c
2 changed files with 9 additions and 5 deletions

View File

@ -64,5 +64,10 @@
<i class="icon-arrow-right3 size-18"></i>
</div>
</div>
<ion-infinite-scroll
ng-if="index.historyShowMore"
on-infinite="index.showMore()"
distance="1%">
</ion-infinite-scroll>
</ion-content>
</ion-modal-view>

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) {
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) {
var self = this;
var SOFT_CONFIRMATION_LIMIT = 12;
var errors = bwcService.getErrors();
@ -967,9 +967,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.historyShowMore = false;
} else {
self.txHistory = self.completeHistory.slice(0, self.nextTxHistory);
self.txHistorySearchResults = self.txHistory;
$log.debug('Total txs: ', self.txHistorySearchResults.length + '/' + self.completeHistory.length);
if (self.txHistorySearchResults.length >= self.completeHistory.length)
$log.debug('Total txs: ', self.txHistory.length + '/' + self.completeHistory.length);
if (self.txHistory.length >= self.completeHistory.length)
self.historyShowMore = false;
}
self.nextTxHistory += self.historyShowMoreLimit;
@ -996,6 +995,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (isCordova)
window.plugins.toast.hide();
self.throttleSearch();
$ionicScrollDelegate.resize();
}
self.throttleSearch = lodash.throttle(function() {
@ -1098,7 +1098,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.isSearching = false;
self.nextTxHistory = self.historyShowMoreLimit;
self.txHistory = self.completeHistory ? self.completeHistory.slice(0, self.historyShowLimit) : null;
self.txHistorySearchResults = self.txHistory;
self.historyShowMore = self.completeHistory ? self.completeHistory.length > self.historyShowLimit : null;
};