mirror of https://github.com/BTCPrivate/copay.git
delete fc from preferences
This commit is contained in:
parent
965619740b
commit
4e599c38e7
|
@ -1,7 +1,9 @@
|
|||
<ion-view view-title="Add wallet">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="tabs.home" class="button button-clear button-dark">Close</a>
|
||||
</ion-nav-buttons>
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-buttons side="primary">
|
||||
<a href ui-sref="tabs.home" class="button button-clear button-dark">Close</a>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
|
@ -23,4 +25,3 @@
|
|||
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Backup Flow</ion-nav-title>
|
||||
<ion-nav-buttons side="primary" ng-show="(step != 1 && step != 4)">
|
||||
<button class="button" ng-click="goToStep(1); goBack()">
|
||||
<button class="button" ng-click="goBack()">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Export Wallet</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferencesAdvanced">
|
||||
<button class="button" href ui-sref="wallet.preferencesAdvanced">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
<div class="item item-divider">
|
||||
Preferences
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="preferencesAlias">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.preferencesAlias">
|
||||
<span translate>Wallet Name</span>
|
||||
<span class="item-note">
|
||||
{{alias||walletName}}
|
||||
{{alias||wallet.walletName}}
|
||||
</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
|
@ -34,29 +34,29 @@
|
|||
<div class="item" ng-show="index.isPrivKeyExternal">
|
||||
<span translate>Hardware wallet</span>
|
||||
<span class="item-note">
|
||||
{{externalSource}}
|
||||
{{wallet.externalSource}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="preferencesColor">
|
||||
<span ng-style="{'color': backgroundColor}">█</span>
|
||||
<div class="item item-icon-right" href ui-sref="wallet.preferencesColor">
|
||||
<span ng-style="{'color': wallet.color}">█</span>
|
||||
<span translate>Wallet Color</span>
|
||||
<span class="item-note">
|
||||
{{index.alias||index.walletName}}
|
||||
{{wallet.alias||wallet.walletName}}
|
||||
</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="preferencesEmail">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.preferencesEmail">
|
||||
<span translate>Email Notifications</span>
|
||||
<span class="item-note">
|
||||
<span ng-if="!index.preferences.email" translate>Disabled</span>
|
||||
<span ng-if="index.preferences.email">{{index.preferences.email}}</span>
|
||||
<span ng-if="!wallet.email" translate>Disabled</span>
|
||||
<span ng-if="wallet.email">{{wallet.email}}</span>
|
||||
</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-divider">
|
||||
Security
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="backup" ng-hide="index.isPrivKeyExternal">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.backup" ng-hide="index.isPrivKeyExternal">
|
||||
<span translate>Backup</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
|
@ -65,14 +65,14 @@
|
|||
<span class="toggle-label" translate>Request Spending Password</span>
|
||||
</ion-toggle>
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="deleteWords" ng-show ="!deleted">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.deleteWords" ng-show ="!deleted">
|
||||
<span translate>Delete recovery phrase</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-divider">
|
||||
Advanced
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="preferencesAdvanced">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.preferencesAdvanced">
|
||||
<span translate>Advanced</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Advanced Preferences</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferences">
|
||||
<button class="button" href ui-sref="wallet.preferences">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
@ -11,27 +11,27 @@
|
|||
<div class="list">
|
||||
<div class="item item-divider">
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="information">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.information">
|
||||
<span translate>Wallet Information</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-icon-right" ng-show="index.network == 'livenet'" href ui-sref="paperWallet">
|
||||
<div class="item item-icon-right" ng-show="index.network == 'livenet'" href ui-sref="wallet.paperWallet">
|
||||
<span translate>Sweep paper wallet</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="export">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.export">
|
||||
<span translate>Export Wallet</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="preferencesBwsUrl">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.preferencesBwsUrl">
|
||||
<span translate>Wallet Service URL</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="preferencesHistory">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.preferencesHistory">
|
||||
<span translate>Transaction History</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
<div class="item item-icon-right" href ui-sref="delete">
|
||||
<div class="item item-icon-right" href ui-sref="wallet.delete">
|
||||
<span translate>Delete Wallet</span>
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Alias</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferences">
|
||||
<button class="button" href ui-sref="wallet.preferences">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Wallet Service URL</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferencesAdvanced">
|
||||
<button class="button" href ui-sref="wallet.preferencesAdvanced">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Color</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferences">
|
||||
<button class="button" href ui-sref="wallet.preferences">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Delete Wallet</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferencesAdvanced">
|
||||
<button class="button" href ui-sref="wallet.preferencesAdvanced">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Delete Recovery Phrase</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferences">
|
||||
<button class="button" href ui-sref="wallet.preferences">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
@ -13,9 +13,9 @@
|
|||
{{error|translate}}
|
||||
</div>
|
||||
<div translate>Warning!</div>
|
||||
<div ng-show="!index.needsBackup" translate>Once you have copied your wallet recovery phrase down, it is recommended to delete it from this device.</div>
|
||||
<div ng-show="index.needsBackup" translate>Need to do backup</div>
|
||||
<div ng-show="!index.needsBackup">
|
||||
<div ng-show="!needsBackup" translate>Once you have copied your wallet recovery phrase down, it is recommended to delete it from this device.</div>
|
||||
<div ng-show="needsBackup" translate>Need to do backup</div>
|
||||
<div ng-show="!needsBackup">
|
||||
<button class="button button-block button-stable" ng-click="delete()" translate>Delete Recovery Phrase</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Email Notifications</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferences">
|
||||
<button class="button" href ui-sref="wallet.preferences">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Transaction History</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferencesAdvanced">
|
||||
<button class="button" href ui-sref="wallet.preferencesAdvanced">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
<ion-view>
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Wallet Information</ion-nav-title>
|
||||
<ion-nav-title>Wallet Information</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button" href ui-sref="preferencesAdvanced">
|
||||
<button class="button" href ui-sref="wallet.preferencesAdvanced">
|
||||
<i class="ion-arrow-left-c"></i> Back
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<ion-view>
|
||||
<ion-nav-title>Global Settings</ion-nav-title>
|
||||
<ion-nav-bar class="bar-stable">
|
||||
<ion-nav-title>Global Settings</ion-nav-title>
|
||||
</ion-nav-bar>
|
||||
<ion-content class="has-header" ng-controller="tabSettingsController" cache-view="false" ng-init="init()">
|
||||
<div class="item item-divider">
|
||||
</div>
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content delegate-handle="my-handle" overflow-scroll="true">
|
||||
<button class="button button-icon icon ion-ios-settings" href ui-sref="wallet.preferences"></button>
|
||||
|
||||
<ion-content class="has-header" delegate-handle="my-handle" overflow-scroll="true">
|
||||
<div ng-show="!wallet">
|
||||
No Wallet
|
||||
<a href ui-sref="tabs.home" class="button">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backupController',
|
||||
function($rootScope, $scope, $timeout, $log, go, lodash, fingerprintService, platformInfo, configService, profileService, gettext, bwcService, walletService, ongoingProcess) {
|
||||
function($rootScope, $scope, $timeout, $log, $state, lodash, fingerprintService, platformInfo, configService, profileService, gettext, bwcService, walletService, ongoingProcess) {
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
var prevState;
|
||||
|
@ -69,7 +69,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
};
|
||||
|
||||
$scope.goBack = function() {
|
||||
go.path(prevState || 'walletHome');
|
||||
$state.go('wallet.preferences');
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
|
|
|
@ -3,40 +3,33 @@
|
|||
angular.module('copayApp.controllers').controller('preferencesController',
|
||||
function($scope, $rootScope, $timeout, $log, $stateParams, configService, profileService, fingerprintService, walletService) {
|
||||
|
||||
var fc;
|
||||
var config = configService.getSync();
|
||||
console.log($stateParams);
|
||||
var disableFocusListener = $rootScope.$on('Local/NewFocusedWalletReady', function() {
|
||||
$scope.init();
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
disableFocusListener();
|
||||
});
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.credentials.walletId;
|
||||
$scope.wallet = wallet;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.externalSource = null;
|
||||
|
||||
fc = profileService.focusedClient;
|
||||
if (fc) {
|
||||
|
||||
$scope.backgroundColor = fc.color;
|
||||
if (wallet) {
|
||||
walletService.updateStatus(wallet, {}, function(err, status) {});
|
||||
var config = configService.getSync();
|
||||
config.aliasFor = config.aliasFor || {};
|
||||
$scope.walletName = fc.credentials.walletName;
|
||||
$scope.alias = config.aliasFor[fc.credentials.walletId] || $scope.walletName;
|
||||
$scope.encryptEnabled = walletService.isEncrypted(fc);
|
||||
if (fc.isPrivKeyExternal)
|
||||
$scope.externalSource = fc.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
|
||||
$scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;
|
||||
$scope.color = config.colorFor[walletId] || '#4A90E2';
|
||||
|
||||
$scope.encryptEnabled = walletService.isEncrypted(wallet);
|
||||
if (wallet.isPrivKeyExternal)
|
||||
$scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
|
||||
|
||||
// TODO externalAccount
|
||||
//this.externalIndex = fc.getExternalIndex();
|
||||
//this.externalIndex = wallet.getExternalIndex();
|
||||
}
|
||||
|
||||
$scope.touchidAvailable = fingerprintService.isAvailable();
|
||||
$scope.touchidEnabled = config.touchIdFor ? config.touchIdFor[fc.credentials.walletId] : null;
|
||||
$scope.touchidEnabled = config.touchIdFor ? config.touchIdFor[walletId] : null;
|
||||
|
||||
$scope.deleted = false;
|
||||
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) {
|
||||
if (wallet.credentials && !wallet.credentials.mnemonicEncrypted && !wallet.credentials.mnemonic) {
|
||||
$scope.deleted = true;
|
||||
}
|
||||
};
|
||||
|
@ -44,40 +37,40 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
var handleEncryptedWallet = function(cb) {
|
||||
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
|
||||
if (err) return cb(err);
|
||||
return cb(walletService.unlock(fc, password));
|
||||
return cb(walletService.unlock(wallet, password));
|
||||
});
|
||||
};
|
||||
|
||||
$scope.encryptChange = function() {
|
||||
if (!fc) return;
|
||||
if (!wallet) return;
|
||||
var val = $scope.encryptEnabled;
|
||||
|
||||
var setPrivateKeyEncryption = function(password, cb) {
|
||||
$log.debug('Encrypting private key for', fc.credentials.walletName);
|
||||
$log.debug('Encrypting private key for', wallet.credentials.walletName);
|
||||
|
||||
fc.setPrivateKeyEncryption(password);
|
||||
fc.lock();
|
||||
profileService.updateCredentials(JSON.parse(fc.export()), function() {
|
||||
wallet.setPrivateKeyEncryption(password);
|
||||
wallet.lock();
|
||||
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
|
||||
$log.debug('Wallet encrypted');
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
var disablePrivateKeyEncryption = function(cb) {
|
||||
$log.debug('Disabling private key encryption for', fc.credentials.walletName);
|
||||
$log.debug('Disabling private key encryption for', wallet.credentials.walletName);
|
||||
|
||||
try {
|
||||
fc.disablePrivateKeyEncryption();
|
||||
wallet.disablePrivateKeyEncryption();
|
||||
} catch (e) {
|
||||
return cb(e);
|
||||
}
|
||||
profileService.updateCredentials(JSON.parse(fc.export()), function() {
|
||||
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
|
||||
$log.debug('Wallet encryption disabled');
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
if (val && !walletService.isEncrypted(fc)) {
|
||||
if (val && !walletService.isEncrypted(wallet)) {
|
||||
$rootScope.$emit('Local/NeedsPassword', true, function(err, password) {
|
||||
if (err || !password) {
|
||||
$scope.encryptEnabled = false;
|
||||
|
@ -89,7 +82,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
});
|
||||
});
|
||||
} else {
|
||||
if (!val && walletService.isEncrypted(fc)) {
|
||||
if (!val && walletService.isEncrypted(wallet)) {
|
||||
handleEncryptedWallet(function(err) {
|
||||
if (err) {
|
||||
$scope.encryptEnabled = true;
|
||||
|
@ -110,14 +103,13 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
};
|
||||
|
||||
$scope.touchidChange = function() {
|
||||
var walletId = fc.credentials.walletId;
|
||||
|
||||
var opts = {
|
||||
touchIdFor: {}
|
||||
};
|
||||
opts.touchIdFor[walletId] = $scope.touchidEnabled;
|
||||
|
||||
fingerprintService.check(fc, function(err) {
|
||||
fingerprintService.check(wallet, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
$timeout(function() {
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesAliasController',
|
||||
function($scope, $timeout, configService, profileService, go) {
|
||||
function($scope, $timeout, $stateParams, $state, configService, profileService, walletService) {
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
var walletId = fc.credentials.walletId;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.wallet = wallet;
|
||||
var walletId = wallet.credentials.walletId;
|
||||
var config = configService.getSync();
|
||||
|
||||
config.aliasFor = config.aliasFor || {};
|
||||
$scope.walletName = fc.credentials.walletName;
|
||||
$scope.alias = config.aliasFor[walletId] || $scope.walletName;
|
||||
$scope.walletName = wallet.credentials.walletName;
|
||||
$scope.alias = config.aliasFor[walletId] || wallet.walletName;
|
||||
|
||||
$scope.save = function() {
|
||||
var opts = {
|
||||
|
@ -18,14 +19,8 @@ angular.module('copayApp.controllers').controller('preferencesAliasController',
|
|||
opts.aliasFor[walletId] = $scope.alias;
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
if (err) {
|
||||
$scope.$emit('Local/DeviceError', err);
|
||||
return;
|
||||
}
|
||||
$scope.$emit('Local/AliasUpdated');
|
||||
$timeout(function() {
|
||||
go.path('preferences');
|
||||
}, 50);
|
||||
if (err) $log.warn(err);
|
||||
$state.go('wallet.preferences')
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, configService, profileService, go) {
|
||||
angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, $stateParams, $state, configService, profileService) {
|
||||
|
||||
$scope.colorList = [
|
||||
'#DD4B39',
|
||||
|
@ -19,8 +19,9 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
|
|||
'#7A8C9E',
|
||||
];
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
var walletId = fc.credentials.walletId;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.wallet = wallet;
|
||||
var walletId = wallet.credentials.walletId;
|
||||
var config = configService.getSync();
|
||||
config.colorFor = config.colorFor || {};
|
||||
|
||||
|
@ -33,9 +34,8 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
|
|||
opts.colorFor[walletId] = color;
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
go.preferences();
|
||||
if (err) $log.warn(err);
|
||||
$scope.$emit('Local/ColorUpdated');
|
||||
$state.go('wallet.preferences');
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($rootScope, $scope, go, profileService, walletService) {
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($rootScope, $scope, $state, $stateParams, profileService, walletService) {
|
||||
|
||||
$scope.save = function(form) {
|
||||
var fc = profileService.focusedClient;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var email = $scope.email || '';
|
||||
|
||||
walletService.updateRemotePreferences(fc, {
|
||||
walletService.updateRemotePreferences(wallet, {
|
||||
email: email,
|
||||
}, function(err) {
|
||||
if (!err)
|
||||
$rootScope.$emit('Local/EmailUpdated', email);
|
||||
go.path('preferences');
|
||||
if (err) $log.warn(err);
|
||||
$state.go('wallet.preferences');
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -85,7 +85,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
$scope.wallet = wallet;
|
||||
|
||||
if (wallet) {
|
||||
profileService.setAndStoreFocus(wallet.id, function() {});
|
||||
walletService.updateStatus(wallet, {}, function(err, status) {
|
||||
if (err) {} // TODO
|
||||
});
|
||||
|
|
176
src/js/routes.js
176
src/js/routes.js
|
@ -105,13 +105,68 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
})
|
||||
.state('wallet.details', {
|
||||
url: '/details',
|
||||
needProfile: true,
|
||||
templateUrl: 'views/walletDetails.html'
|
||||
templateUrl: 'views/walletDetails.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.preferences', {
|
||||
url: '/preferences',
|
||||
needProfile: true,
|
||||
templateUrl: 'views/preferences.html'
|
||||
templateUrl: 'views/preferences.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.preferencesAlias', {
|
||||
url: '/preferencesAlias',
|
||||
templateUrl: 'views/preferencesAlias.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.preferencesColor', {
|
||||
url: '/preferencesColor',
|
||||
templateUrl: 'views/preferencesColor.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.preferencesEmail', {
|
||||
url: '/preferencesEmail',
|
||||
templateUrl: 'views/preferencesEmail.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.backup', {
|
||||
url: '/backup',
|
||||
templateUrl: 'views/backup.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.preferencesAdvanced', {
|
||||
url: '/preferencesAdvanced',
|
||||
templateUrl: 'views/preferencesAdvanced.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.information', {
|
||||
url: '/information',
|
||||
templateUrl: 'views/preferencesInformation.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.export', {
|
||||
url: '/export',
|
||||
templateUrl: 'views/export.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.preferencesBwsUrl', {
|
||||
url: '/preferencesBwsUrl',
|
||||
templateUrl: 'views/preferencesBwsUrl.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.preferencesHistory', {
|
||||
url: '/preferencesHistory',
|
||||
templateUrl: 'views/preferencesHistory.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.deleteWords', {
|
||||
url: '/deleteWords',
|
||||
templateUrl: 'views/preferencesDeleteWords.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('wallet.delete', {
|
||||
url: '/delete',
|
||||
templateUrl: 'views/preferencesDeleteWallet.html',
|
||||
needProfile: true
|
||||
})
|
||||
.state('walletHome', {
|
||||
url: '/old',
|
||||
|
@ -415,26 +470,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesAdvanced', {
|
||||
url: '/preferencesAdvanced',
|
||||
templateUrl: 'views/preferencesAdvanced.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAdvanced.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesColor', {
|
||||
url: '/preferencesColor',
|
||||
templateUrl: 'views/preferencesColor.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesColor.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesAltCurrency', {
|
||||
url: '/preferencesAltCurrency',
|
||||
templateUrl: 'views/preferencesAltCurrency.html',
|
||||
|
@ -445,79 +480,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesAlias', {
|
||||
url: '/preferencesAlias',
|
||||
templateUrl: 'views/preferencesAlias.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAlias.html'
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
.state('preferencesEmail', {
|
||||
url: '/preferencesEmail',
|
||||
templateUrl: 'views/preferencesEmail.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesEmail.html'
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
.state('preferencesBwsUrl', {
|
||||
url: '/preferencesBwsUrl',
|
||||
templateUrl: 'views/preferencesBwsUrl.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesBwsUrl.html'
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
.state('preferencesHistory', {
|
||||
url: '/preferencesHistory',
|
||||
templateUrl: 'views/preferencesHistory.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesHistory.html'
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
.state('deleteWords', {
|
||||
url: '/deleteWords',
|
||||
templateUrl: 'views/preferencesDeleteWords.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesDeleteWords.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('delete', {
|
||||
url: '/delete',
|
||||
templateUrl: 'views/preferencesDeleteWallet.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesDeleteWallet.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('information', {
|
||||
url: '/information',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesInformation.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('about', {
|
||||
url: '/about',
|
||||
templateUrl: 'views/preferencesAbout.html',
|
||||
|
@ -538,16 +500,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
},
|
||||
}
|
||||
})
|
||||
.state('export', {
|
||||
url: '/export',
|
||||
templateUrl: 'views/export.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/export.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('paperWallet', {
|
||||
url: '/paperWallet',
|
||||
templateUrl: 'views/paperWallet.html',
|
||||
|
@ -558,16 +510,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
},
|
||||
}
|
||||
})
|
||||
.state('backup', {
|
||||
url: '/backup',
|
||||
templateUrl: 'views/backup.html',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/backup.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesGlobal', {
|
||||
url: '/preferencesGlobal',
|
||||
needProfile: true,
|
||||
|
|
|
@ -10,15 +10,15 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
var root = {};
|
||||
|
||||
|
||||
// // RECEIVE
|
||||
// // Check address
|
||||
// root.isUsed(wallet.walletId, balance.byAddress, function(err, used) {
|
||||
// if (used) {
|
||||
// $log.debug('Address used. Creating new');
|
||||
// $rootScope.$emit('Local/AddressIsUsed');
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // RECEIVE
|
||||
// // Check address
|
||||
// root.isUsed(wallet.walletId, balance.byAddress, function(err, used) {
|
||||
// if (used) {
|
||||
// $log.debug('Address used. Creating new');
|
||||
// $rootScope.$emit('Local/AddressIsUsed');
|
||||
// }
|
||||
// });
|
||||
//
|
||||
|
||||
root.Utils = bwcService.getUtils();
|
||||
root.formatAmount = function(amount, fullPrecision) {
|
||||
|
@ -71,7 +71,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
root.needsBackup = function(wallet, cb) {
|
||||
|
||||
if (!walletService.requiresBackup(wallet))
|
||||
if (!root.requiresBackup(wallet))
|
||||
return cb(false);
|
||||
|
||||
storageService.getBackupFlag(wallet.credentials.walletId, function(err, val) {
|
||||
|
@ -103,8 +103,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
return; // TODO!!!
|
||||
if (err instanceof errors.NOT_AUTHORIZED) {
|
||||
|
||||
console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
|
||||
// TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
|
||||
console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
|
||||
// TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
|
||||
self.notAuthorized = true;
|
||||
go.walletHome();
|
||||
} else if (err instanceof errors.NOT_FOUND) {
|
||||
|
@ -178,19 +178,18 @@ console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
|
|||
};
|
||||
|
||||
root.setStatus = function(wallet, status) {
|
||||
|
||||
wallet.status = status;
|
||||
wallet.statusUpdatedOn = Date.now();
|
||||
wallet.isValid = true;
|
||||
root.setBalance(wallet, status.balance);
|
||||
|
||||
wallet.email = status.preferences.email;
|
||||
};
|
||||
|
||||
root.updateStatus = function(wallet, opts, cb, initStatusHash, tries) {
|
||||
tries = tries || 0;
|
||||
opts = opts || {};
|
||||
|
||||
if (wallet.isValid && ! opts.force)
|
||||
if (wallet.isValid && !opts.force)
|
||||
return;
|
||||
|
||||
|
||||
|
@ -799,7 +798,7 @@ console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
|
|||
};
|
||||
|
||||
root.getAddress = function(wallet, forceNew, cb) {
|
||||
console.log('[walletService.js.786:wallet:]',wallet, forceNew); //TODO
|
||||
console.log('[walletService.js.786:wallet:]', wallet, forceNew); //TODO
|
||||
|
||||
var firstStep;
|
||||
if (forceNew) {
|
||||
|
|
Loading…
Reference in New Issue