mirror of https://github.com/BTCPrivate/copay.git
improve speed list
This commit is contained in:
parent
1524d26f10
commit
4df40c61bd
|
@ -2,11 +2,18 @@
|
||||||
ng-init="titleSection='Alternative Currency'; goBackToState = 'preferencesGlobal'; noColor = true">
|
ng-init="titleSection='Alternative Currency'; goBackToState = 'preferencesGlobal'; noColor = true">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content preferences" ng-controller="preferencesAltCurrencyController">
|
<div class="content preferences" ng-controller="preferencesAltCurrencyController" ng-init="init()">
|
||||||
<h4></h4>
|
<h4></h4>
|
||||||
|
|
||||||
<ion-radio class="line-b size-12 radio-label" ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency" ng-model="currentCurrency"
|
<ion-content>
|
||||||
|
<ion-radio class="line-b size-12 radio-label" ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"
|
||||||
ng-click="save(altCurrency)">{{altCurrency.name}}
|
ng-click="save(altCurrency)">{{altCurrency.name}}
|
||||||
</ion-radio>
|
</ion-radio>
|
||||||
|
<ion-infinite-scroll
|
||||||
|
ng-if="!listComplete"
|
||||||
|
on-infinite="loadMore()"
|
||||||
|
distance="1%">
|
||||||
|
</ion-infinite-scroll>
|
||||||
|
</ion-content>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
|
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
|
||||||
function($scope, $log, configService, rateService, lodash, go, profileService, walletService) {
|
function($scope, $log, $timeout, configService, rateService, lodash, go, profileService, walletService) {
|
||||||
|
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
|
var next = 10;
|
||||||
|
var completeAlternativeList;
|
||||||
|
$scope.currentCurrency = config.wallet.settings.alternativeIsoCode;
|
||||||
|
$scope.listComplete = false;
|
||||||
|
|
||||||
$scope.currentCurrency = {
|
$scope.init = function() {
|
||||||
name: config.wallet.settings.alternativeName,
|
|
||||||
isoCode: config.wallet.settings.alternativeIsoCode
|
|
||||||
};
|
|
||||||
|
|
||||||
rateService.whenAvailable(function() {
|
rateService.whenAvailable(function() {
|
||||||
$scope.altCurrencyList = rateService.listAlternatives();
|
completeAlternativeList = rateService.listAlternatives();
|
||||||
|
lodash.remove(completeAlternativeList, function(c) {
|
||||||
lodash.remove($scope.altCurrencyList, function(c) {
|
|
||||||
return c.isoCode == 'BTC';
|
return c.isoCode == 'BTC';
|
||||||
});
|
});
|
||||||
|
$scope.altCurrencyList = completeAlternativeList.slice(0, next);
|
||||||
lodash.each($scope.altCurrencyList, function(altCurrency) {
|
|
||||||
if (config.wallet.settings.alternativeIsoCode === altCurrency.isoCode)
|
|
||||||
$scope.currentCurrency = altCurrency;
|
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$digest();
|
$scope.loadMore = function() {
|
||||||
});
|
$timeout(function() {
|
||||||
|
$scope.altCurrencyList = completeAlternativeList.slice(0, next);
|
||||||
|
next += 10;
|
||||||
|
$scope.listComplete = $scope.altCurrencyList.length >= completeAlternativeList.length;
|
||||||
|
$scope.$broadcast('scroll.infiniteScrollComplete');
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.save = function(newAltCurrency) {
|
$scope.save = function(newAltCurrency) {
|
||||||
var opts = {
|
var opts = {
|
||||||
|
|
Loading…
Reference in New Issue