diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index 20c2f3c8b1f0cef8038f28b2a6b095ff1599a95e..fd5f693ca669a0995b8f82be678a784c56a263a2 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -687,6 +687,8 @@ function WalletTxController($scope, $ionicPopover, $state, $timeout, $location, 'ngInject'; $scope.loading = true; + $scope.loadingMore = false; + $scope.lastMoreTxTime = null; $scope.settings = csSettings.data; $scope.listeners = []; $scope.qrcodeId = 'qrcode-wallet-tx-' + $scope.$id; @@ -913,12 +915,19 @@ function WalletTxController($scope, $ionicPopover, $state, $timeout, $location, return $scope.goState('app.view_wallet_tx_errors_by_id', {id: wallet.id}); }; - - $scope.showMoreTx = function(fromTime) { if ($scope.loadingMore) return; // Skip + // Add a delay if previous load has been done recently + var waitDelayMs = $scope.lastMoreTxTime ? Date.now() - $scope.lastMoreTxTime : BMA.constants.LIMIT_REQUEST_DELAY; + if (waitDelayMs > 0 && waitDelayMs < BMA.constants.LIMIT_REQUEST_DELAY) { + return $timeout(function() { + return $scope.showMoreTx(fromTime); + }, waitDelayMs); + } + $scope.loadingMore = true; + $scope.loadingMoreTime = Date.now(); fromTime = fromTime || ($scope.formData.tx.fromTime - csSettings.data.walletHistoryTimeSecond) ||