revert updateTxs sync
This commit is contained in:
parent
2bd90f528b
commit
738995fd80
1 changed files with 11 additions and 33 deletions
|
|
@ -42,9 +42,9 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.updateTxs = _.throttle(function(cb) {
|
$scope.updateTxs = _.throttle(function() {
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
if (!w || !cb) return;
|
if (!w) return;
|
||||||
|
|
||||||
var res = w.getPendingTxProposals();
|
var res = w.getPendingTxProposals();
|
||||||
_.each(res.txs, function(tx) {
|
_.each(res.txs, function(tx) {
|
||||||
|
|
@ -61,7 +61,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return cb(res.txs);
|
$scope.txps = res.txs;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -120,24 +120,14 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$rootScope.pendingTxCount = 0;
|
$rootScope.pendingTxCount = 0;
|
||||||
$scope.updateTxs(function(txps) {
|
$scope.updateTxs();
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
w.on('txProposalEvent', function() {
|
w.on('txProposalEvent', $scope.updateTxs);
|
||||||
$scope.updateTxs(function(txps) {
|
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on("$destroy", function(){
|
$scope.$on("$destroy", function(){
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
w.removeListener('txProposalEvent', function() {
|
w.removeListener('txProposalEvent', $scope.updateTxs );
|
||||||
$scope.updateTxs(function(txps) {
|
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.showAddressBook = function() {
|
$scope.showAddressBook = function() {
|
||||||
|
|
@ -165,9 +155,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
|
|
||||||
$scope.error = message;
|
$scope.error = message;
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.updateTxs(function(txps) {
|
$scope.updateTxs();
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitForm = function(form) {
|
$scope.submitForm = function(form) {
|
||||||
|
|
@ -213,9 +201,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
if (err) return $scope._showError(err);
|
if (err) return $scope._showError(err);
|
||||||
|
|
||||||
$scope.notifyStatus(status);
|
$scope.notifyStatus(status);
|
||||||
$scope.updateTxs(function(txps) {
|
$scope.updateTxs();
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -436,11 +422,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
w.issueTx(ntxid, function(err, txid, status) {
|
w.issueTx(ntxid, function(err, txid, status) {
|
||||||
$scope.notifyStatus(status);
|
$scope.notifyStatus(status);
|
||||||
if (cb) return cb();
|
if (cb) return cb();
|
||||||
else {
|
else $scope.updateTxs();
|
||||||
$scope.updateTxs(function(txps) {
|
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -450,18 +432,14 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
w.signAndSend(ntxid, function(err, id, status) {
|
w.signAndSend(ntxid, function(err, id, status) {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.notifyStatus(status);
|
$scope.notifyStatus(status);
|
||||||
$scope.updateTxs(function(txps) {
|
$scope.updateTxs();
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.reject = function(ntxid) {
|
$scope.reject = function(ntxid) {
|
||||||
w.reject(ntxid);
|
w.reject(ntxid);
|
||||||
notification.warning('Transaction rejected', 'You rejected the transaction successfully');
|
notification.warning('Transaction rejected', 'You rejected the transaction successfully');
|
||||||
$scope.updateTxs(function(txps) {
|
$scope.updateTxs();
|
||||||
$scope.txps = txps;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.clearMerchant = function(callback) {
|
$scope.clearMerchant = function(callback) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue