delete focused wallet

This commit is contained in:
Gabriel Bazán 2016-08-19 13:09:27 -03:00
commit 6e4a1e7ff2
28 changed files with 184 additions and 194 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('backupService', function backupServiceFactory($log, $timeout, profileService, sjcl) {
.factory('backupService', function backupServiceFactory($log, $timeout, $stateParams, profileService, sjcl) {
var root = {};
@ -57,10 +57,10 @@ angular.module('copayApp.services')
if (!password) {
return null;
}
var fc = profileService.focusedClient;
var wallet = profileService.getWallet($stateParams.walletId);
try {
opts = opts || {};
var b = fc.export(opts);
var b = wallet.export(opts);
if (opts.addressBook) b = root.addMetadata(b, opts);
var e = sjcl.encrypt(password, b, {
@ -74,11 +74,11 @@ angular.module('copayApp.services')
};
root.walletDownload = function(password, opts, cb) {
var fc = profileService.focusedClient;
var wallet = profileService.getWallet($stateParams.walletId);
var ew = root.walletExport(password, opts);
if (!ew) return cb('Could not create backup');
var walletName = (fc.alias || '') + (fc.alias ? '-' : '') + fc.credentials.walletName;
var walletName = (wallet.alias || '') + (wallet.alias ? '-' : '') + wallet.credentials.walletName;
if (opts.noSign) walletName = walletName + '-noSign'
var filename = walletName + '-Copaybackup.aes.json';
_download(ew, filename, cb)