delete fc from preferences

This commit is contained in:
Gabriel Bazán 2016-08-17 15:53:17 -03:00
commit 4e599c38e7
24 changed files with 173 additions and 243 deletions

View file

@ -1,20 +1,24 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, confirmDialog, lodash, notification, profileService, go, gettext) {
var fc = profileService.focusedClient;
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $state, $stateParams, confirmDialog, lodash, notification, profileService, walletService, gettext) {
var wallet = profileService.getWallet($stateParams.walletId);
var msg = gettext('Are you sure you want to delete the recovery phrase?');
var successMsg = gettext('Recovery phrase deleted');
if (lodash.isEmpty(fc.credentials.mnemonic) && lodash.isEmpty(fc.credentials.mnemonicEncrypted))
walletService.needsBackup(wallet, function(needsBackup) {
$scope.needsBackup = needsBackup;
});
if (lodash.isEmpty(wallet.credentials.mnemonic) && lodash.isEmpty(wallet.credentials.mnemonicEncrypted))
$scope.deleted = true;
$scope.delete = function() {
confirmDialog.show(msg, function(ok) {
if (ok) {
fc.clearMnemonic();
profileService.updateCredentials(JSON.parse(fc.export()), function() {
wallet.clearMnemonic();
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
notification.success(successMsg);
go.walletHome();
$state.go('wallet.details');
});
}
});