delete words option + confirmDialog refactor
This commit is contained in:
parent
ee04b7f318
commit
04c0d20525
10 changed files with 115 additions and 57 deletions
|
|
@ -1,7 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('wordsController',
|
||||
function($rootScope, $scope, $timeout, profileService, go, gettext) {
|
||||
function($rootScope, $scope, $timeout, profileService, go, gettext, confirmDialog, notification) {
|
||||
|
||||
var msg = gettext('Are you to delete the backup words?');
|
||||
var successMsg = gettext('Backup words deleted');
|
||||
|
||||
this.getMnemonic = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
var words = fc.getMnemonic();
|
||||
|
|
@ -12,4 +16,19 @@ angular.module('copayApp.controllers').controller('wordsController',
|
|||
this.done = function() {
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
};
|
||||
|
||||
this.delete = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
confirmDialog.show(msg,function(ok){
|
||||
if (ok) {
|
||||
fc.clearMnemonic();
|
||||
profileService.updateCredentialsFC(function() {
|
||||
notification.success(successMsg);
|
||||
go.walletHome();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.mywords = this.getMnemonic();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -773,7 +773,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.recreate = function(cb) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, feeService, bwsError, utilService) {
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, feeService, bwsError, confirmDialog, utilService) {
|
||||
|
||||
var self = this;
|
||||
$rootScope.hideMenuBar = false;
|
||||
|
|
@ -1138,6 +1138,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
this.setForm(null, amount, null, feeRate);
|
||||
};
|
||||
|
||||
// TODO: showPopup alike
|
||||
this.confirmDialog = function(msg, cb) {
|
||||
if (isCordova) {
|
||||
navigator.notification.confirm(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue