Add partial backup at create and join

This commit is contained in:
Yemel Jardi 2014-07-07 17:09:24 -03:00
commit f9fad5d62f
3 changed files with 8 additions and 4 deletions

View file

@ -81,6 +81,7 @@ angular.module('copayApp.controllers').controller('SetupController',
passphrase: passphrase,
};
var w = walletFactory.create(opts);
backupService.download(w);
controllerUtils.startNetwork(w, $scope);
});
};

View file

@ -70,6 +70,7 @@ angular.module('copayApp.controllers').controller('SigninController',
notification.error('Unknown error');
controllerUtils.onErrorDigest();
} else {
backupService.download(w);
controllerUtils.startNetwork(w, $scope);
}
});

View file

@ -11,10 +11,12 @@ BackupService.prototype.getName = function(wallet) {
BackupService.prototype.download = function(wallet) {
var ew = wallet.toEncryptedObj();
var timestamp = +(new Date());
var walletName = this.getName(wallet);
var filename = walletName + '-' + timestamp + '-keybackup.json.aes';
this.notifications.success('Backup created', 'Encrypted backup file saved.');
var partial = !wallet.publicKeyRing.isComplete();
var walletName = this.getName(wallet) + (partial ? '-Partial' : '');
var filename = walletName + '-keybackup.json.aes';
var notify = partial ? 'Partial backup created' : 'Backup created';
this.notifications.success(notify, 'Encrypted backup file saved.');
var blob = new Blob([ew], {
type: 'text/plain;charset=utf-8'
});