make explicit refreshes when storing wallet
This commit is contained in:
parent
de1464f95d
commit
22cd4cae94
2 changed files with 25 additions and 29 deletions
|
|
@ -127,7 +127,6 @@ Wallet.prototype._handleNetworkChange = function(newCopayerId) {
|
|||
this.sendWalletId(newCopayerId);
|
||||
this.emit('peer', this.network.peerFromCopayer(newCopayerId));
|
||||
}
|
||||
this.emit('refresh');
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -231,17 +230,10 @@ Wallet.prototype.getRegisteredPeerIds = function() {
|
|||
return this.registeredPeerIds;
|
||||
};
|
||||
|
||||
Wallet.prototype.store = function(isSync) {
|
||||
Wallet.prototype.store = function() {
|
||||
var wallet = this.toObj();
|
||||
this.storage.setFromObj(this.id, wallet);
|
||||
|
||||
if (isSync) {
|
||||
this.log('Wallet stored.'); //TODO
|
||||
} else {
|
||||
this.log('Wallet stored. REFRESH Emitted'); //TODO
|
||||
this.emit('refresh');
|
||||
}
|
||||
|
||||
this.log('Wallet stored');
|
||||
};
|
||||
|
||||
Wallet.prototype.toObj = function() {
|
||||
|
|
@ -319,7 +311,8 @@ Wallet.prototype.sendPublicKeyRing = function(recipients) {
|
|||
Wallet.prototype.generateAddress = function(isChange) {
|
||||
var addr = this.publicKeyRing.generateAddress(isChange);
|
||||
this.sendPublicKeyRing();
|
||||
this.store(true);
|
||||
this.store();
|
||||
this.emit('refresh');
|
||||
return addr;
|
||||
};
|
||||
|
||||
|
|
@ -346,7 +339,8 @@ Wallet.prototype.reject = function(ntxid) {
|
|||
|
||||
txp.rejectedBy[myId] = Date.now();
|
||||
this.sendTxProposals();
|
||||
this.store(true);
|
||||
this.store();
|
||||
this.emit('refresh');
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -363,14 +357,14 @@ Wallet.prototype.sign = function(ntxid) {
|
|||
var before = b.signaturesAdded;
|
||||
b.sign(keys);
|
||||
|
||||
var ret = false;
|
||||
if (b.signaturesAdded > before) {
|
||||
txp.signedBy[myId] = Date.now();
|
||||
this.sendTxProposals();
|
||||
this.store(true);
|
||||
ret = true;
|
||||
this.store();
|
||||
this.emit('refresh');
|
||||
return true;
|
||||
}
|
||||
return ret;
|
||||
return false;
|
||||
};
|
||||
|
||||
Wallet.prototype.sendTx = function(ntxid, cb) {
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ angular.module('copay.controllerUtils')
|
|||
$location.path('addresses');
|
||||
});
|
||||
w.on('refresh', function() {
|
||||
//alert('refresh');
|
||||
root.updateBalance(function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
|
@ -93,6 +94,7 @@ angular.module('copay.controllerUtils')
|
|||
w.on('openError', root.onErrorDigest);
|
||||
w.on('peer', function(peerID) {
|
||||
video.callPeer(peerID, handlePeerVideo);
|
||||
$rootScope.$digest();
|
||||
});
|
||||
w.on('close', root.onErrorDigest);
|
||||
w.netStart();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue