Add full backup stage with user feedback

This commit is contained in:
Yemel Jardi 2014-07-08 10:43:10 -03:00
commit c145290167
3 changed files with 29 additions and 14 deletions

View file

@ -80,7 +80,11 @@ PublicKeyRing.prototype.registeredCopayers = function() {
};
PublicKeyRing.prototype.isComplete = function() {
return this.registeredCopayers() === this.totalCopayers;
return this.remainingCopayers() == 0;
};
PublicKeyRing.prototype.remainingCopayers = function() {
return this.totalCopayers - this.registeredCopayers();
};
PublicKeyRing.prototype.getAllCopayerIds = function() {
@ -361,14 +365,18 @@ PublicKeyRing.prototype.setBackupReady = function(copayerId) {
}
PublicKeyRing.prototype.isBackupReady = function(copayerId) {
var cid = this.myCopayerId();
var cid = copayerId || this.myCopayerId();
return this.copayersBackup.indexOf(cid) != -1;
}
PublicKeyRing.prototype.isFullyBackup = function(copayerId) {
return this.copayersBackup.length == this.totalCopayers;
return this.remainingBackups() == 0;
}
PublicKeyRing.prototype.remainingBackups = function() {
return this.totalCopayers - this.copayersBackup.length;
};
PublicKeyRing.prototype.merge = function(inPKR, ignoreId) {
this._checkInPKR(inPKR, ignoreId);

View file

@ -327,6 +327,7 @@ Wallet.prototype.getRegisteredPeerIds = function() {
var pid = this.network.peerFromCopayer(cid);
this.registeredPeerIds.push({
peerId: pid,
copayerId: cid,
nick: this.publicKeyRing.nicknameForCopayer(cid),
index: i,
});
@ -885,7 +886,8 @@ Wallet.prototype.isReady = function() {
Wallet.prototype.setBackupReady = function() {
this.publicKeyRing.setBackupReady();
this.emit('publicKeyRingUpdated', false);
this.sendPublicKeyRing();
this.store();
};
Wallet.prototype.signJson = function(payload) {