add multiple optiomizations for 30+ tx wallets

This commit is contained in:
Matias Alejo Garcia 2014-05-17 01:19:52 -03:00
commit ba5a3ac2c6
8 changed files with 121 additions and 70 deletions

View file

@ -21,12 +21,6 @@ angular.module('copay.header').controller('HeaderController',
'link': '#/backup'
}];
$rootScope.$watch('wallet', function(wallet) {
if (wallet) {
controllerUtils.updateTxs();
}
});
// Initialize alert notification (not show when init wallet)
$rootScope.txAlertCount = 0;
$notification.enableHtml5Mode(); // for chrome: if support, enable it

View file

@ -3,6 +3,7 @@
angular.module('copay.setup').controller('SetupController',
function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase) {
$rootScope.videoInfo = {};
$scope.loading = false;
$scope.walletPassword = $rootScope.walletPassword;
@ -37,8 +38,6 @@ angular.module('copay.setup').controller('SetupController',
$rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'};
return;
}
$scope.loading = true;
Passphrase.getBase64Async($scope.walletPassword, function(passphrase){
var opts = {

View file

@ -6,9 +6,7 @@ angular.module('copay.signin').controller('SigninController',
var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase();
return v1 > v2 ? 1 : ( v1 < v2 ) ? -1 : 0;
};
$rootScope.videoInfo = {};
$scope.loading = $scope.failure = false;
$scope.wallets = walletFactory.getWallets().sort(cmp);
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
@ -46,7 +44,9 @@ angular.module('copay.signin').controller('SigninController',
$rootScope.$digest();
return;
}
console.log('[signin.js.49]'); //TODO
installStartupHandlers(w);
console.log('[signin.js.52]'); //TODO
controllerUtils.startNetwork(w);
});
};

View file

@ -5,13 +5,40 @@ angular.module('copay.transactions').controller('TransactionsController',
$scope.title = 'Transactions';
$scope.loading = false;
$scope.onlyPending = true;
$scope.lastShowed = false;
$scope.update = function () {
$scope.loading = false;
controllerUtils.updateTxs();
controllerUtils.updateTxs({onlyPending:$scope.onlyPending});
$rootScope.$digest();
};
$scope.show = function (onlyPending) {
$scope.loading=true;
$scope.onlyPending = onlyPending;
setTimeout(function(){
$scope.update();
}, 10);
};
$scope.toogleLast = function () {
console.log('[toogleLast]');
$scope.loading=true;
$scope.lastShowed = !$scope.lastShowed;
if ($scope.lastShowed) {
$scope.getTransactions(function(txs){
$scope.loading=false;
$scope.blockchain_txs = txs;
$rootScope.$digest();
});
}
else {
$scope.loading=false;
$rootScope.$digest();
}
};
$scope.send = function (ntxid,cb) {
$scope.loading = true;
$rootScope.txAlertCount = 0;
@ -36,32 +63,31 @@ angular.module('copay.transactions').controller('TransactionsController',
type:'error',
message: 'There was an error signing the Transaction',
};
$scope.update();
}
else {
$scope.update();
} else {
var p = w.txProposals.getTxProposal(ntxid);
if (p.builder.isFullySigned()) {
$scope.send(ntxid, function() {
$scope.update();
});
}
else $scope.update();
else
$scope.update();
}
});
};
$scope.getTransactions = function() {
$scope.getTransactions = function(cb) {
var w =$rootScope.wallet;
if (w) {
var addresses = w.getAddressesStr();
console.log('### Querying last transactions...'); //TODO
var addresses = w.getAddressesStr();
if (addresses.length > 0) {
w.blockchain.getTransactions(addresses, function(txs) {
$scope.blockchain_txs = txs;
$rootScope.$digest();
});
return w.blockchain.getTransactions(addresses, cb);
}
}
return cb();
};
$scope.getShortNetworkName = function() {