mirror of https://github.com/BTCPrivate/copay.git
update tx proposals on #send
This commit is contained in:
parent
c215b3c15e
commit
3ea948e6ba
|
@ -41,7 +41,9 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.updateTxs = function() {
|
|
||||||
|
$scope.updateTxs = _.throttle(function() {
|
||||||
|
console.log('[send.js.44:updateTxs:]'); //TODO
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
if (!w) return;
|
if (!w) return;
|
||||||
|
|
||||||
|
@ -60,11 +62,12 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.txps = res.txs;
|
$scope.txps = res.txs;
|
||||||
};
|
}, 1000);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting the two related amounts as properties prevents an infinite
|
* Setting the two related amounts as properties prevents an infinite
|
||||||
* recursion for watches while preserving the original angular updates
|
* recursion for watches while preserving the original angular updates
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
Object.defineProperty($scope,
|
Object.defineProperty($scope,
|
||||||
"alternative", {
|
"alternative", {
|
||||||
|
@ -106,11 +109,14 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$rootScope.pendingTxCount = 0;
|
$rootScope.pendingTxCount = 0;
|
||||||
$scope.updateTxs();
|
$scope.updateTxs();
|
||||||
setTimeout(function() {
|
var w = $rootScope.wallet;
|
||||||
$scope.loading = false;
|
w.on('txProposalEvent', $scope.updateTxs);
|
||||||
$rootScope.$digest();
|
};
|
||||||
}, 1);
|
|
||||||
}
|
$scope.$on("$destroy", function(){
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
w.removeListener('txProposalEvent', $scope.updateTxs );
|
||||||
|
});
|
||||||
|
|
||||||
$scope.showAddressBook = function() {
|
$scope.showAddressBook = function() {
|
||||||
return w && _.keys(w.addressBook).length > 0;
|
return w && _.keys(w.addressBook).length > 0;
|
||||||
|
@ -419,16 +425,14 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
$scope.sign = function(ntxid) {
|
$scope.sign = function(ntxid) {
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
$scope.error = $scope.success = null;
|
$scope.error = $scope.success = null;
|
||||||
|
|
||||||
w.signAndSend(ntxid, function(err, id, status) {
|
w.signAndSend(ntxid, function(err, id, status) {
|
||||||
|
$scope.loading = false;
|
||||||
$scope.notifyStatus(status);
|
$scope.notifyStatus(status);
|
||||||
$scope.updateTxs();
|
$scope.updateTxs();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.reject = function(ntxid) {
|
$scope.reject = function(ntxid) {
|
||||||
$scope.loading = true;
|
|
||||||
$rootScope.txAlertCount = 0;
|
|
||||||
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();
|
$scope.updateTxs();
|
||||||
|
|
|
@ -126,7 +126,6 @@ angular.module('copayApp.services')
|
||||||
root.installWalletHandlers = function(w) {
|
root.installWalletHandlers = function(w) {
|
||||||
var wid = w.getId();
|
var wid = w.getId();
|
||||||
w.on('connectionError', function() {
|
w.on('connectionError', function() {
|
||||||
console.log('err', w.getName()); //TODO
|
|
||||||
if (root.isFocused(wid)) {
|
if (root.isFocused(wid)) {
|
||||||
var message = "Could not connect to the Insight server. Check your settings and network configuration";
|
var message = "Could not connect to the Insight server. Check your settings and network configuration";
|
||||||
notification.error('Networking Error', message);
|
notification.error('Networking Error', message);
|
||||||
|
@ -134,7 +133,6 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('corrupt', function(peerId) {
|
w.on('corrupt', function(peerId) {
|
||||||
console.log('corr', w.getName()); //TODO
|
|
||||||
if (root.isFocused(wid)) {
|
if (root.isFocused(wid)) {
|
||||||
notification.error('Error', $filter('translate')('Received corrupt message from ') + peerId);
|
notification.error('Error', $filter('translate')('Received corrupt message from ') + peerId);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +147,6 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('tx', function(address, isChange) {
|
w.on('tx', function(address, isChange) {
|
||||||
console.log('tx', w.getName()); //TODO
|
|
||||||
if (!isChange) {
|
if (!isChange) {
|
||||||
notification.funds('Funds received on ' + w.getName(), address);
|
notification.funds('Funds received on ' + w.getName(), address);
|
||||||
}
|
}
|
||||||
|
@ -159,14 +156,12 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('balanceUpdated', function() {
|
w.on('balanceUpdated', function() {
|
||||||
console.log('b', w.getName()); //TODO
|
|
||||||
balanceService.update(w, function() {
|
balanceService.update(w, function() {
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
}, root.isFocused(wid));
|
}, root.isFocused(wid));
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('insightReconnected', function() {
|
w.on('insightReconnected', function() {
|
||||||
console.log('i', w.getName()); //TODO
|
|
||||||
$rootScope.reconnecting = false;
|
$rootScope.reconnecting = false;
|
||||||
balanceService.update(w, function() {
|
balanceService.update(w, function() {
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
@ -174,14 +169,13 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('insightError', function() {
|
w.on('insightError', function() {
|
||||||
console.log('i', w.getName()); //TODO
|
|
||||||
if (root.isFocused(wid)) {
|
if (root.isFocused(wid)) {
|
||||||
$rootScope.reconnecting = true;
|
$rootScope.reconnecting = true;
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
w.on('newAddresses', function() {
|
w.on('newAddresses', function() {
|
||||||
console.log('newAddress', w.getName()); //TODO
|
// Nothing yet
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('txProposalsUpdated', function() {
|
w.on('txProposalsUpdated', function() {
|
||||||
|
|
Loading…
Reference in New Issue