Merge branch 'ref/design' of github.com:matiu/copay into ref/design

This commit is contained in:
Matias Alejo Garcia 2016-08-17 17:31:58 -03:00
commit 78b51ff938
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
24 changed files with 173 additions and 243 deletions

View file

@ -1,7 +1,9 @@
<ion-view view-title="Add wallet"> <ion-view view-title="Add wallet">
<ion-nav-buttons side="primary"> <ion-nav-bar class="bar-stable">
<a href ui-sref="tabs.home" class="button button-clear button-dark">Close</a> <ion-nav-buttons side="primary">
</ion-nav-buttons> <a href ui-sref="tabs.home" class="button button-clear button-dark">Close</a>
</ion-nav-buttons>
</ion-nav-bar>
<ion-content> <ion-content>
<ion-list> <ion-list>
@ -23,4 +25,3 @@
</ion-content> </ion-content>
</ion-view> </ion-view>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Backup Flow</ion-nav-title> <ion-nav-title>Backup Flow</ion-nav-title>
<ion-nav-buttons side="primary" ng-show="(step != 1 && step != 4)"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -3,7 +3,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Export Wallet</ion-nav-title> <ion-nav-title>Export Wallet</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -12,10 +12,10 @@
<div class="item item-divider"> <div class="item item-divider">
Preferences Preferences
</div> </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 translate>Wallet Name</span>
<span class="item-note"> <span class="item-note">
{{alias||walletName}} {{alias||wallet.walletName}}
</span> </span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>
@ -34,29 +34,29 @@
<div class="item" ng-show="index.isPrivKeyExternal"> <div class="item" ng-show="index.isPrivKeyExternal">
<span translate>Hardware wallet</span> <span translate>Hardware wallet</span>
<span class="item-note"> <span class="item-note">
{{externalSource}} {{wallet.externalSource}}
</span> </span>
</div> </div>
<div class="item item-icon-right" href ui-sref="preferencesColor"> <div class="item item-icon-right" href ui-sref="wallet.preferencesColor">
<span ng-style="{'color': backgroundColor}">&block;</span> <span ng-style="{'color': wallet.color}">&block;</span>
<span translate>Wallet Color</span> <span translate>Wallet Color</span>
<span class="item-note"> <span class="item-note">
{{index.alias||index.walletName}} {{wallet.alias||wallet.walletName}}
</span> </span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </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 translate>Email Notifications</span>
<span class="item-note"> <span class="item-note">
<span ng-if="!index.preferences.email" translate>Disabled</span> <span ng-if="!wallet.email" translate>Disabled</span>
<span ng-if="index.preferences.email">{{index.preferences.email}}</span> <span ng-if="wallet.email">{{wallet.email}}</span>
</span> </span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>
<div class="item item-divider"> <div class="item item-divider">
Security Security
</div> </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> <span translate>Backup</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>
@ -65,14 +65,14 @@
<span class="toggle-label" translate>Request Spending Password</span> <span class="toggle-label" translate>Request Spending Password</span>
</ion-toggle> </ion-toggle>
</div> </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> <span translate>Delete recovery phrase</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>
<div class="item item-divider"> <div class="item item-divider">
Advanced Advanced
</div> </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> <span translate>Advanced</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Advanced Preferences</ion-nav-title> <ion-nav-title>Advanced Preferences</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>
@ -11,27 +11,27 @@
<div class="list"> <div class="list">
<div class="item item-divider"> <div class="item item-divider">
</div> </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> <span translate>Wallet Information</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </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> <span translate>Sweep paper wallet</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </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> <span translate>Export Wallet</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </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> <span translate>Wallet Service URL</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </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> <span translate>Transaction History</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </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> <span translate>Delete Wallet</span>
<i class="icon ion-ios-arrow-right"></i> <i class="icon ion-ios-arrow-right"></i>
</div> </div>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Alias</ion-nav-title> <ion-nav-title>Alias</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Wallet Service URL</ion-nav-title> <ion-nav-title>Wallet Service URL</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Color</ion-nav-title> <ion-nav-title>Color</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Delete Wallet</ion-nav-title> <ion-nav-title>Delete Wallet</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Delete Recovery Phrase</ion-nav-title> <ion-nav-title>Delete Recovery Phrase</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>
@ -13,9 +13,9 @@
{{error|translate}} {{error|translate}}
</div> </div>
<div translate>Warning!</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="!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="needsBackup" translate>Need to do backup</div>
<div ng-show="!index.needsBackup"> <div ng-show="!needsBackup">
<button class="button button-block button-stable" ng-click="delete()" translate>Delete Recovery Phrase</button> <button class="button button-block button-stable" ng-click="delete()" translate>Delete Recovery Phrase</button>
</div> </div>
</div> </div>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Email Notifications</ion-nav-title> <ion-nav-title>Email Notifications</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Transaction History</ion-nav-title> <ion-nav-title>Transaction History</ion-nav-title>
<ion-nav-buttons side="primary"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -1,9 +1,8 @@
<ion-view> <ion-view>
<ion-nav-bar class="bar-stable"> <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"> <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      <i class="ion-arrow-left-c"></i> Back
   </button>    </button>
  </ion-nav-buttons>   </ion-nav-buttons>

View file

@ -1,5 +1,7 @@
<ion-view> <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()"> <ion-content class="has-header" ng-controller="tabSettingsController" cache-view="false" ng-init="init()">
<div class="item item-divider"> <div class="item item-divider">
</div> </div>

View file

@ -14,9 +14,7 @@
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content delegate-handle="my-handle" overflow-scroll="true"> <ion-content class="has-header" delegate-handle="my-handle" overflow-scroll="true">
<button class="button button-icon icon ion-ios-settings" href ui-sref="wallet.preferences"></button>
<div ng-show="!wallet"> <div ng-show="!wallet">
No Wallet No Wallet
<a href ui-sref="tabs.home" class="button"> <a href ui-sref="tabs.home" class="button">

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('backupController', 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 fc = profileService.focusedClient;
var prevState; var prevState;
@ -69,7 +69,7 @@ angular.module('copayApp.controllers').controller('backupController',
}; };
$scope.goBack = function() { $scope.goBack = function() {
go.path(prevState || 'walletHome'); $state.go('wallet.preferences');
}; };
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {

View file

@ -3,40 +3,33 @@
angular.module('copayApp.controllers').controller('preferencesController', angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $timeout, $log, $stateParams, configService, profileService, fingerprintService, walletService) { function($scope, $rootScope, $timeout, $log, $stateParams, configService, profileService, fingerprintService, walletService) {
var fc; var wallet = profileService.getWallet($stateParams.walletId);
var config = configService.getSync(); var walletId = wallet.credentials.walletId;
console.log($stateParams); $scope.wallet = wallet;
var disableFocusListener = $rootScope.$on('Local/NewFocusedWalletReady', function() {
$scope.init();
});
$scope.$on('$destroy', function() {
disableFocusListener();
});
$scope.init = function() { $scope.init = function() {
$scope.externalSource = null; $scope.externalSource = null;
fc = profileService.focusedClient; if (wallet) {
if (fc) { walletService.updateStatus(wallet, {}, function(err, status) {});
var config = configService.getSync();
$scope.backgroundColor = fc.color;
config.aliasFor = config.aliasFor || {}; config.aliasFor = config.aliasFor || {};
$scope.walletName = fc.credentials.walletName; $scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;
$scope.alias = config.aliasFor[fc.credentials.walletId] || $scope.walletName; $scope.color = config.colorFor[walletId] || '#4A90E2';
$scope.encryptEnabled = walletService.isEncrypted(fc);
if (fc.isPrivKeyExternal) $scope.encryptEnabled = walletService.isEncrypted(wallet);
$scope.externalSource = fc.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor'; if (wallet.isPrivKeyExternal)
$scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
// TODO externalAccount // TODO externalAccount
//this.externalIndex = fc.getExternalIndex(); //this.externalIndex = wallet.getExternalIndex();
} }
$scope.touchidAvailable = fingerprintService.isAvailable(); $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; $scope.deleted = false;
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) { if (wallet.credentials && !wallet.credentials.mnemonicEncrypted && !wallet.credentials.mnemonic) {
$scope.deleted = true; $scope.deleted = true;
} }
}; };
@ -44,40 +37,40 @@ angular.module('copayApp.controllers').controller('preferencesController',
var handleEncryptedWallet = function(cb) { var handleEncryptedWallet = function(cb) {
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) { $rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
if (err) return cb(err); if (err) return cb(err);
return cb(walletService.unlock(fc, password)); return cb(walletService.unlock(wallet, password));
}); });
}; };
$scope.encryptChange = function() { $scope.encryptChange = function() {
if (!fc) return; if (!wallet) return;
var val = $scope.encryptEnabled; var val = $scope.encryptEnabled;
var setPrivateKeyEncryption = function(password, cb) { 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); wallet.setPrivateKeyEncryption(password);
fc.lock(); wallet.lock();
profileService.updateCredentials(JSON.parse(fc.export()), function() { profileService.updateCredentials(JSON.parse(wallet.export()), function() {
$log.debug('Wallet encrypted'); $log.debug('Wallet encrypted');
return cb(); return cb();
}); });
}; };
var disablePrivateKeyEncryption = function(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 { try {
fc.disablePrivateKeyEncryption(); wallet.disablePrivateKeyEncryption();
} catch (e) { } catch (e) {
return cb(e); return cb(e);
} }
profileService.updateCredentials(JSON.parse(fc.export()), function() { profileService.updateCredentials(JSON.parse(wallet.export()), function() {
$log.debug('Wallet encryption disabled'); $log.debug('Wallet encryption disabled');
return cb(); return cb();
}); });
}; };
if (val && !walletService.isEncrypted(fc)) { if (val && !walletService.isEncrypted(wallet)) {
$rootScope.$emit('Local/NeedsPassword', true, function(err, password) { $rootScope.$emit('Local/NeedsPassword', true, function(err, password) {
if (err || !password) { if (err || !password) {
$scope.encryptEnabled = false; $scope.encryptEnabled = false;
@ -89,7 +82,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
}); });
}); });
} else { } else {
if (!val && walletService.isEncrypted(fc)) { if (!val && walletService.isEncrypted(wallet)) {
handleEncryptedWallet(function(err) { handleEncryptedWallet(function(err) {
if (err) { if (err) {
$scope.encryptEnabled = true; $scope.encryptEnabled = true;
@ -110,14 +103,13 @@ angular.module('copayApp.controllers').controller('preferencesController',
}; };
$scope.touchidChange = function() { $scope.touchidChange = function() {
var walletId = fc.credentials.walletId;
var opts = { var opts = {
touchIdFor: {} touchIdFor: {}
}; };
opts.touchIdFor[walletId] = $scope.touchidEnabled; opts.touchIdFor[walletId] = $scope.touchidEnabled;
fingerprintService.check(fc, function(err) { fingerprintService.check(wallet, function(err) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
$timeout(function() { $timeout(function() {

View file

@ -1,15 +1,16 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesAliasController', 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 wallet = profileService.getWallet($stateParams.walletId);
var walletId = fc.credentials.walletId; $scope.wallet = wallet;
var walletId = wallet.credentials.walletId;
var config = configService.getSync(); var config = configService.getSync();
config.aliasFor = config.aliasFor || {}; config.aliasFor = config.aliasFor || {};
$scope.walletName = fc.credentials.walletName; $scope.walletName = wallet.credentials.walletName;
$scope.alias = config.aliasFor[walletId] || $scope.walletName; $scope.alias = config.aliasFor[walletId] || wallet.walletName;
$scope.save = function() { $scope.save = function() {
var opts = { var opts = {
@ -18,14 +19,8 @@ angular.module('copayApp.controllers').controller('preferencesAliasController',
opts.aliasFor[walletId] = $scope.alias; opts.aliasFor[walletId] = $scope.alias;
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) { if (err) $log.warn(err);
$scope.$emit('Local/DeviceError', err); $state.go('wallet.preferences')
return;
}
$scope.$emit('Local/AliasUpdated');
$timeout(function() {
go.path('preferences');
}, 50);
}); });
}; };
}); });

View file

@ -1,6 +1,6 @@
'use strict'; '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 = [ $scope.colorList = [
'#DD4B39', '#DD4B39',
@ -19,8 +19,9 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
'#7A8C9E', '#7A8C9E',
]; ];
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var walletId = fc.credentials.walletId; $scope.wallet = wallet;
var walletId = wallet.credentials.walletId;
var config = configService.getSync(); var config = configService.getSync();
config.colorFor = config.colorFor || {}; config.colorFor = config.colorFor || {};
@ -33,9 +34,8 @@ angular.module('copayApp.controllers').controller('preferencesColorController',
opts.colorFor[walletId] = color; opts.colorFor[walletId] = color;
configService.set(opts, function(err) { configService.set(opts, function(err) {
go.preferences();
if (err) $log.warn(err); if (err) $log.warn(err);
$scope.$emit('Local/ColorUpdated'); $state.go('wallet.preferences');
}); });
}; };
}); });

View file

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

View file

@ -1,17 +1,16 @@
'use strict'; '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) { $scope.save = function(form) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var email = $scope.email || ''; var email = $scope.email || '';
walletService.updateRemotePreferences(fc, { walletService.updateRemotePreferences(wallet, {
email: email, email: email,
}, function(err) { }, function(err) {
if (!err) if (err) $log.warn(err);
$rootScope.$emit('Local/EmailUpdated', email); $state.go('wallet.preferences');
go.path('preferences');
}); });
}; };

View file

@ -85,7 +85,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.wallet = wallet; $scope.wallet = wallet;
if (wallet) { if (wallet) {
profileService.setAndStoreFocus(wallet.id, function() {});
walletService.updateStatus(wallet, {}, function(err, status) { walletService.updateStatus(wallet, {}, function(err, status) {
if (err) {} // TODO if (err) {} // TODO
}); });

View file

@ -105,13 +105,68 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}) })
.state('wallet.details', { .state('wallet.details', {
url: '/details', url: '/details',
needProfile: true, templateUrl: 'views/walletDetails.html',
templateUrl: 'views/walletDetails.html' needProfile: true
}) })
.state('wallet.preferences', { .state('wallet.preferences', {
url: '/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('wallet.copayers', { .state('wallet.copayers', {
url: '/copayers', url: '/copayers',
@ -435,26 +490,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', { .state('preferencesAltCurrency', {
url: '/preferencesAltCurrency', url: '/preferencesAltCurrency',
templateUrl: 'views/preferencesAltCurrency.html', templateUrl: 'views/preferencesAltCurrency.html',
@ -465,79 +500,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', { .state('about', {
url: '/about', url: '/about',
templateUrl: 'views/preferencesAbout.html', templateUrl: 'views/preferencesAbout.html',
@ -558,16 +520,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', { .state('paperWallet', {
url: '/paperWallet', url: '/paperWallet',
templateUrl: 'views/paperWallet.html', templateUrl: 'views/paperWallet.html',
@ -578,16 +530,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', { .state('preferencesGlobal', {
url: '/preferencesGlobal', url: '/preferencesGlobal',
needProfile: true, needProfile: true,

View file

@ -10,15 +10,15 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
var root = {}; var root = {};
// // RECEIVE // // RECEIVE
// // Check address // // Check address
// root.isUsed(wallet.walletId, balance.byAddress, function(err, used) { // root.isUsed(wallet.walletId, balance.byAddress, function(err, used) {
// if (used) { // if (used) {
// $log.debug('Address used. Creating new'); // $log.debug('Address used. Creating new');
// $rootScope.$emit('Local/AddressIsUsed'); // $rootScope.$emit('Local/AddressIsUsed');
// } // }
// }); // });
// //
root.Utils = bwcService.getUtils(); root.Utils = bwcService.getUtils();
root.formatAmount = function(amount, fullPrecision) { root.formatAmount = function(amount, fullPrecision) {
@ -71,7 +71,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.needsBackup = function(wallet, cb) { root.needsBackup = function(wallet, cb) {
if (!walletService.requiresBackup(wallet)) if (!root.requiresBackup(wallet))
return cb(false); return cb(false);
storageService.getBackupFlag(wallet.credentials.walletId, function(err, val) { storageService.getBackupFlag(wallet.credentials.walletId, function(err, val) {
@ -103,8 +103,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
return; // TODO!!! return; // TODO!!!
if (err instanceof errors.NOT_AUTHORIZED) { if (err instanceof errors.NOT_AUTHORIZED) {
console.log('[walletService.js.93] TODO NOT AUTH'); //TODO console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
// TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO // TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
self.notAuthorized = true; self.notAuthorized = true;
go.walletHome(); go.walletHome();
} else if (err instanceof errors.NOT_FOUND) { } 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) { root.setStatus = function(wallet, status) {
wallet.status = status; wallet.status = status;
wallet.statusUpdatedOn = Date.now(); wallet.statusUpdatedOn = Date.now();
wallet.isValid = true; wallet.isValid = true;
root.setBalance(wallet, status.balance); root.setBalance(wallet, status.balance);
wallet.email = status.preferences.email;
}; };
root.updateStatus = function(wallet, opts, cb, initStatusHash, tries) { root.updateStatus = function(wallet, opts, cb, initStatusHash, tries) {
tries = tries || 0; tries = tries || 0;
opts = opts || {}; opts = opts || {};
if (wallet.isValid && ! opts.force) if (wallet.isValid && !opts.force)
return; return;
@ -799,7 +798,7 @@ console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
}; };
root.getAddress = function(wallet, forceNew, cb) { 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; var firstStep;
if (forceNew) { if (forceNew) {