diff --git a/public/views/preferences.html b/public/views/preferences.html index ff31aaa0f..8cd8e7649 100644 --- a/public/views/preferences.html +++ b/public/views/preferences.html @@ -9,8 +9,8 @@

-
+
+ + + +
+ +

+
diff --git a/public/views/preferencesAdvanced.html b/public/views/preferencesAdvanced.html index 1fc70c1a0..47a043629 100644 --- a/public/views/preferencesAdvanced.html +++ b/public/views/preferencesAdvanced.html @@ -7,6 +7,7 @@

+ +
diff --git a/public/views/preferencesDeleteWords.html b/public/views/preferencesDeleteWords.html new file mode 100644 index 000000000..ea3fb4be7 --- /dev/null +++ b/public/views/preferencesDeleteWords.html @@ -0,0 +1,53 @@ +
+
+ + +
+ +

+ +
+ + Wallet: {{index.walletName}} + ({{index.alias}}) + +
+ +

Warning!

+ +
+ + + {{preferences.error|translate}} + + +
+ +
+ +

+ + Once you have copied your wallet seed down, it is recommended to delete it from this device. + +

+ +

+ + Need to do backup + +

+ + + +
+ +
diff --git a/src/js/controllers/preferences.js b/src/js/controllers/preferences.js index 1701f16be..046d4e6da 100644 --- a/src/js/controllers/preferences.js +++ b/src/js/controllers/preferences.js @@ -2,7 +2,13 @@ angular.module('copayApp.controllers').controller('preferencesController', function($scope, $rootScope, $timeout, $log, configService, profileService) { - + + var fc = profileService.focusedClient; + $scope.deleted = false; + if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) { + $scope.deleted = true; + } + this.init = function() { var config = configService.getSync(); var fc = profileService.focusedClient; @@ -37,8 +43,8 @@ angular.module('copayApp.controllers').controller('preferencesController', }); }); } else { - if (!val && fc.hasPrivKeyEncrypted()) { - profileService.unlockFC(function(err){ + if (!val && fc.hasPrivKeyEncrypted()) { + profileService.unlockFC(function(err) { if (err) { $scope.encrypt = true; return; @@ -70,14 +76,13 @@ angular.module('copayApp.controllers').controller('preferencesController', opts.touchIdFor[walletId] = newVal; $rootScope.$emit('Local/RequestTouchid', function(err) { - if (err) { + if (err) { $log.debug(err); $timeout(function() { $scope.touchidError = true; $scope.touchid = oldVal; }, 100); - } - else { + } else { configService.set(opts, function(err) { if (err) { $log.debug(err); diff --git a/src/js/controllers/preferencesDeleteWords.js b/src/js/controllers/preferencesDeleteWords.js new file mode 100644 index 000000000..0bec17ebd --- /dev/null +++ b/src/js/controllers/preferencesDeleteWords.js @@ -0,0 +1,23 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', + function(confirmDialog, notification, profileService, go, gettext) { + var self = this; + var fc = profileService.focusedClient; + var msg = gettext('Are you sure you want to delete the backup words?'); + var successMsg = gettext('Backup words deleted'); + + self.delete = function() { + confirmDialog.show(msg, + function(ok) { + if (ok) { + fc.clearMnemonic(); + profileService.updateCredentialsFC(function() { + notification.success(successMsg); + go.walletHome(); + }); + } + }); + }; + + }); diff --git a/src/js/controllers/securityPreferences.js b/src/js/controllers/securityPreferences.js new file mode 100644 index 000000000..b864ae2eb --- /dev/null +++ b/src/js/controllers/securityPreferences.js @@ -0,0 +1,12 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('securityPreferencesController', + function($scope, profileService) { + var self = this; + var fc = profileService.focusedClient; + self.deleted = false; + if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) { + self.deleted = true; + } + + }); diff --git a/src/js/routes.js b/src/js/routes.js index df05f7353..90d408c3d 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -286,29 +286,30 @@ angular }, } }) - .state('preferencesColor', { - url: '/preferencesColor', - templateUrl: 'views/preferencesColor.html', - walletShouldBeComplete: true, - needProfile: true, - views: { - 'main': { - templateUrl: 'views/preferencesColor.html' - }, - } - }) - .state('preferencesAltCurrency', { - url: '/preferencesAltCurrency', - templateUrl: 'views/preferencesAltCurrency.html', + .state('preferencesColor', { + url: '/preferencesColor', + templateUrl: 'views/preferencesColor.html', walletShouldBeComplete: true, needProfile: true, views: { 'main': { - templateUrl: 'views/preferencesAltCurrency.html' + templateUrl: 'views/preferencesColor.html' }, } }) + + .state('preferencesAltCurrency', { + url: '/preferencesAltCurrency', + templateUrl: 'views/preferencesAltCurrency.html', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/preferencesAltCurrency.html' + }, + } + }) .state('preferencesAlias', { url: '/preferencesAlias', templateUrl: 'views/preferencesAlias.html', @@ -345,6 +346,17 @@ angular } }) + .state('deleteWords', { + url: '/deleteWords', + templateUrl: 'views/preferencesDeleteWords.html', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/preferencesDeleteWords.html' + }, + } + }) .state('delete', { url: '/delete', templateUrl: 'views/preferencesDeleteWallet.html', @@ -368,16 +380,16 @@ angular }) .state('about', { - url: '/about', - templateUrl: 'views/preferencesAbout.html', - walletShouldBeComplete: true, - needProfile: true, - views: { - 'main': { - templateUrl: 'views/preferencesAbout.html' - }, - } - }) + url: '/about', + templateUrl: 'views/preferencesAbout.html', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/preferencesAbout.html' + }, + } + }) .state('logs', { url: '/logs', templateUrl: 'views/preferencesLogs.html', @@ -439,14 +451,14 @@ angular }) .state('add', { - url: '/add', - needProfile: true, - views: { - 'main': { - templateUrl: 'views/add.html' - }, - } - }) + url: '/add', + needProfile: true, + views: { + 'main': { + templateUrl: 'views/add.html' + }, + } + }) .state('cordova', { url: '/cordova/:status/:isHome', views: { @@ -525,7 +537,7 @@ angular $state.transitionTo('copayers'); event.preventDefault(); - } + } if (!animationService.transitionAnimated(fromState, toState)) { event.preventDefault();