Wallet/src/js/controllers/backup.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-03-06 12:00:10 -03:00
'use strict';
angular.module('copayApp.controllers').controller('wordsController',
function($rootScope, $scope, $timeout, profileService, go, gettext, confirmDialog, notification) {
2015-09-09 17:53:05 -03:00
var msg = gettext('Are you sure you want to delete the backup words?');
var successMsg = gettext('Backup words deleted');
2015-09-21 10:18:43 -03:00
this.show = false;
this.toggle = function() {
this.show = !this.show;
if (this.show)
$rootScope.$emit('Local/BackupDone');
$timeout(function(){
$scope.$apply();
}, 1);
2015-08-08 10:10:44 -03:00
};
this.delete = function() {
var fc = profileService.focusedClient;
2015-09-18 10:27:36 -03:00
confirmDialog.show(msg, function(ok) {
if (ok) {
fc.clearMnemonic();
profileService.updateCredentialsFC(function() {
notification.success(successMsg);
go.walletHome();
});
}
});
};
2015-09-03 16:49:46 -03:00
var fc = profileService.focusedClient;
var words = fc.getMnemonic();
2015-09-18 10:27:36 -03:00
if (words) {
this.mnemonicWords = words.split(/[\u3000\s]+/);
2015-09-18 10:27:36 -03:00
this.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
this.useIdeograms = words.indexOf("\u3000") >= 0;
}
2015-09-03 16:49:46 -03:00
2015-03-06 12:00:10 -03:00
});