removed comments
This commit is contained in:
parent
feca8b5807
commit
4cf268682b
2 changed files with 3 additions and 59 deletions
|
|
@ -239,23 +239,18 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
return;
|
||||
}
|
||||
|
||||
console.log('pagination Got cached txs, count: ', txHistory.length);
|
||||
formatTxHistoryForDisplay(txHistory);
|
||||
|
||||
completeTxHistory = txHistory;
|
||||
showHistory(false);
|
||||
console.log('pagination Showing tx history items:', $scope.txHistory.length);
|
||||
$scope.$apply();
|
||||
console.log('pagination displayed cached history.');
|
||||
});
|
||||
}
|
||||
|
||||
function fetchAndShowTxHistory(getLatest, flushCacheOnNew) {
|
||||
console.log('pagination fetchAndShowTxHistory() getLatest:', getLatest, ', flushCacheOnNew:', flushCacheOnNew);
|
||||
$scope.vm.updatingTxHistory = true;
|
||||
|
||||
walletHistoryService.updateLocalTxHistoryByPage($scope.wallet, getLatest, flushCacheOnNew, function onUpdateLocalTxHistoryByPage(err, txHistory, fetchedAllTransactions) {
|
||||
console.log('pagination returned');
|
||||
$scope.vm.gettingInitialHistory = false;
|
||||
$scope.vm.updatingTxHistory = false;
|
||||
$scope.$broadcast('scroll.infiniteScrollComplete');
|
||||
|
|
@ -267,11 +262,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
}
|
||||
|
||||
if (fetchedAllTransactions) {
|
||||
console.log("pagination Fetched all transactions.");
|
||||
$scope.vm.fetchedAllTxHistory = true;
|
||||
}
|
||||
|
||||
console.log('pagination txs returned in history: ' + txHistory.length);
|
||||
formatTxHistoryForDisplay(txHistory);
|
||||
|
||||
completeTxHistory = txHistory;
|
||||
|
|
@ -285,7 +278,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
if (completeTxHistory) {
|
||||
$scope.txHistory = showAll ? completeTxHistory : completeTxHistory.slice(0, (currentTxHistoryDisplayPage + 1) * DISPLAY_PAGE_SIZE);
|
||||
$scope.vm.allowInfiniteScroll = !$scope.vm.fetchedAllTxHistory && !(completeTxHistory.length === $scope.txHistory.length && $scope.vm.gettingInitialHistory);
|
||||
console.log('pagination Showing txs: ', $scope.txHistory.length);
|
||||
} else {
|
||||
$scope.vm.allowInfiniteScroll = false;
|
||||
}
|
||||
|
|
@ -331,10 +323,8 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
|
||||
// on-infinite="showMore()"
|
||||
$scope.showMore = function() {
|
||||
console.log('pagination showMore()');
|
||||
// Check if we have more than we are displaying
|
||||
if (completeTxHistory.length > $scope.txHistory.length) {
|
||||
console.log('pagination We have more data than we are displaying.');
|
||||
currentTxHistoryDisplayPage++;
|
||||
showHistory(false);
|
||||
$scope.$broadcast('scroll.infiniteScrollComplete');
|
||||
|
|
@ -357,7 +347,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
};
|
||||
|
||||
$scope.updateAll = function(forceStatusUpdate, flushTxCacheOnNew) {
|
||||
console.log('pagination updateAll()');
|
||||
updateStatus(forceStatusUpdate);
|
||||
//updateTxHistory(cb);
|
||||
fetchAndShowTxHistory(true, flushTxCacheOnNew);
|
||||
|
|
|
|||
|
|
@ -25,39 +25,6 @@
|
|||
};
|
||||
return service;
|
||||
|
||||
/*
|
||||
function hasAllTransactionsFetched(walletId, cachedTxs, newTxs) {
|
||||
var cachedTxIds = {};
|
||||
cachedTxs.forEach(function forCachedTx(tx){
|
||||
cachedTxIds[tx.txid] = true;
|
||||
});
|
||||
|
||||
var someTransactionWereNew = false;
|
||||
var overlappingTxsCount = 0;
|
||||
|
||||
newTxs.forEach(function forNewTx(tx){
|
||||
if (cachedTxIds[tx.txid]) {
|
||||
overlappingTxsCount++;
|
||||
} else {
|
||||
someTransactionWereNew = true;
|
||||
}
|
||||
});
|
||||
|
||||
console.log('pagination Overlapping transactions:', overlappingTxsCount);
|
||||
if (overlappingTxsCount >= MIN_KNOWN_TX_OVERLAP) { // We are good
|
||||
if (!someTransactionWereNew && overlappingTxsCount === newTxs.length) {
|
||||
console.log("We probably have all of the transactions fetched!!")
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
console.log("Something went wrong")
|
||||
return true; // Something went wrong, so stop fetching..
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
function addEarlyTransactions(walletId, cachedTxs, newTxs) {
|
||||
|
||||
var cachedTxIds = {};
|
||||
|
|
@ -77,13 +44,10 @@
|
|||
}
|
||||
});
|
||||
|
||||
console.log('pagination Early transactions overlapping:', overlappingTxsCount);
|
||||
if (overlappingTxsCount >= MIN_KNOWN_TX_OVERLAP) { // We are good
|
||||
if (someTransactionsWereNew) {
|
||||
console.log('pagination someTransactionsWereNew');
|
||||
saveTxHistory(walletId, cachedTxs);
|
||||
} else if (overlappingTxsCount === newTxs.length) {
|
||||
console.log('We probably have all transactions now');
|
||||
allTransactionsFetched = true;
|
||||
}
|
||||
return cachedTxs;
|
||||
|
|
@ -111,15 +75,13 @@
|
|||
if (cachedTxIds[tx.txid]) {
|
||||
overlappingTxsCount++;
|
||||
} else {
|
||||
someTransactionWereNew = true;
|
||||
someTransactionsWereNew = true;
|
||||
uniqueNewTxs.push(tx);
|
||||
}
|
||||
});
|
||||
|
||||
console.log('pagination Latest transactions overlapping:', overlappingTxsCount);
|
||||
if (overlappingTxsCount >= MIN_KNOWN_TX_OVERLAP) { // We are good
|
||||
if (someTransactionsWereNew) {
|
||||
console.log('pagination someTransactionsWereNew');
|
||||
var allTxs = uniqueNewTxs.concat(cachedTxs);
|
||||
saveTxHistory(walletId, allTxs);
|
||||
return allTxs;
|
||||
|
|
@ -155,7 +117,6 @@
|
|||
if (txsFromServer.length === 0) {
|
||||
return cb(null, []);
|
||||
}
|
||||
console.log('pagination Transactions fetched:', txsFromServer.length);
|
||||
|
||||
var processedTxs = processNewTxs(wallet, txsFromServer);
|
||||
|
||||
|
|
@ -224,12 +185,9 @@
|
|||
};
|
||||
|
||||
function saveTxHistory(walletId, processedTxs) {
|
||||
console.log('pagination Saving transactions:', processedTxs.length);
|
||||
storageService.setTxHistory(processedTxs, walletId, function onSetTxHistory(error){
|
||||
if (error) {
|
||||
$log.error('pagination Failed to save tx history.', error);
|
||||
} else {
|
||||
console.log('pagination Save successful.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -238,7 +196,6 @@
|
|||
function updateLocalTxHistoryByPage(wallet, getLatest, flushCacheOnNew, cb) {
|
||||
|
||||
if (flushCacheOnNew) {
|
||||
console.log('pagination Getting latest txs, will then flush cache.');
|
||||
fetchTxHistoryByPage(wallet, 0, function onFetchTxHistory(err, txs){
|
||||
if (err) {
|
||||
return cb(err, txs);
|
||||
|
|
@ -247,7 +204,6 @@
|
|||
return cb(null, txs);
|
||||
});
|
||||
} else {
|
||||
console.log('pagination Getting txs to add to cache.');
|
||||
getCachedTxHistory(wallet.id, function onCachedHistory(err, cachedTxs){
|
||||
if (err) {
|
||||
$log.error('Failed to get cached tx history.', err);
|
||||
|
|
@ -255,7 +211,6 @@
|
|||
}
|
||||
|
||||
var start = getLatest ? 0 : cachedTxs.length;
|
||||
console.log('pagination Transaction fetch start:', start);
|
||||
fetchTxHistoryByPage(wallet, start, function onFetchHistory(err, fetchedTxs){
|
||||
if (err) {
|
||||
return cb(err);
|
||||
|
|
@ -271,7 +226,7 @@
|
|||
} else {
|
||||
allTransactionsFetched = false;
|
||||
txs = addEarlyTransactions(wallet.id, cachedTxs, fetchedTxs);
|
||||
return cb(null, txs, allTransactionsFetched/*, hasAllTransactionsFetched(wallet.id, cachedTxs, fetchedTxs)*/);
|
||||
return cb(null, txs, allTransactionsFetched);
|
||||
}
|
||||
return cb(null, txs);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue