commit
b3c3af5277
5 changed files with 147 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
||||
|
||||
$rootScope.title = 'Profile';
|
||||
$scope.hideAdv = true;
|
||||
|
||||
$scope.downloadProfileBackup = function() {
|
||||
backupService.profileDownload($rootScope.iden);
|
||||
|
|
@ -53,4 +54,17 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
});
|
||||
};
|
||||
|
||||
$scope.deleteProfile = function () {
|
||||
identityService.deleteProfile(function (err, res) {
|
||||
if (err) {
|
||||
log.warn(err);
|
||||
notification.error('Error', 'Could not delete profile');
|
||||
return;
|
||||
}
|
||||
$location.path('/');
|
||||
setTimeout(function () {
|
||||
notification.error('Success', 'Profile successfully deleted');
|
||||
}, 1);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -307,6 +307,33 @@ Identity.prototype.store = function(opts, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} opts
|
||||
* @param {Function} cb
|
||||
*/
|
||||
Identity.prototype.remove = function(opts, cb) {
|
||||
log.debug('Deleting profile');
|
||||
|
||||
var self = this;
|
||||
opts = opts || {};
|
||||
|
||||
async.each(_.values(self.wallets), function(w, cb) {
|
||||
w.close();
|
||||
self.storage.removeItem(Wallet.getStorageKey(w.getId()), function(err) {
|
||||
if (err) return cb(err);
|
||||
cb();
|
||||
});
|
||||
}, function (err) {
|
||||
if (err) return cb(err);
|
||||
|
||||
self.storage.removeItem(self.getId(), function(err) {
|
||||
if (err) return cb(err);
|
||||
self.emitAndKeepAlive('closed');
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Identity.prototype._cleanUp = function() {
|
||||
// NOP
|
||||
};
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
root.deleteProfile = function (cb) {
|
||||
$rootScope.iden.remove(null, cb);
|
||||
};
|
||||
|
||||
root.deleteWallet = function(w, cb) {
|
||||
$rootScope.iden.deleteWallet(w.id, cb);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue