delete focused wallet

This commit is contained in:
Gabriel Bazán 2016-08-19 13:09:27 -03:00
commit 6e4a1e7ff2
28 changed files with 184 additions and 194 deletions

View file

@ -1,7 +1,8 @@
<ion-view ng-controller="backupController" cache-view="false" ng-init="init(index.prevState)"> <ion-view>
<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"> <ion-nav-buttons side="primary">
<<<<<<< 5b14c8aca37bc7b15324fdbbed162dea8cc2d3af
<button class="button no-border" ng-click="goToStep(1)" ng-show="(step != 1 && step != 4)"> <button class="button no-border" ng-click="goToStep(1)" ng-show="(step != 1 && step != 4)">
<i class="icon ion-chevron-left"></i> <i class="icon ion-chevron-left"></i>
</button> </button>
@ -10,9 +11,14 @@
  <span class="button no-border" ng-click="goBack()">   <span class="button no-border" ng-click="goBack()">
<i class="icon ion-close"></i> <i class="icon ion-close"></i>
</span> </span>
=======
 <button class="button" href ui-sref="wallet.preferences">
     <i class="ion-arrow-left-c"></i> Back
   </button>
>>>>>>> delete focused wallet
  </ion-nav-buttons>   </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header"> <ion-content ng-controller="backupController" cache-view="false" ng-init="init()">
<div class="box-notification" ng-show="error"> <div class="box-notification" ng-show="error">
<span class="text-warning"> <span class="text-warning">
{{error|translate}} {{error|translate}}
@ -23,27 +29,27 @@
## STEP 1 ## STEP 1
--> -->
<div class="content preferences text-center"> <div class="text-center">
<div ng-show="step == 1"> <div ng-show="step == 1">
<div ng-show="mnemonicWords || (!credentialsEncrypted && !deleted)" class="row"> <div ng-show="mnemonicWords || (!credentialsEncrypted && !deleted)" class="row">
<h5 class="text-center" translate>Write your wallet recovery phrase</h5> <h5 class="text-center" translate>Write your wallet recovery phrase</h5>
<div class="size-14 text-gray columns" ng-show="(index.n>1 && index.m != index.n )"> <div class="size-14 text-gray columns" ng-show="(wallet.n>1 && wallet.m != wallet.n )">
<span translate> <span translate>
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need To restore this {{wallet.m}}-{{wallet.n}} <b>shared</b> wallet you will need
</span>: </span>:
<div class="m10t columns size-14 text-gray"> <div class="m10t columns size-14 text-gray">
<span translate>Your wallet recovery phrase and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</span> <span translate>Your wallet recovery phrase and access to the server that coordinated the initial wallet creation. You still need {{wallet.m}} keys to spend.</span>
<span translate><b>OR</b> the wallet recovery phrase of <b>all</b> copayers in the wallet</span> <span translate><b>OR</b> the wallet recovery phrase of <b>all</b> copayers in the wallet</span>
<span translate><b>OR</b> 1 wallet export file and the remaining quorum of wallet recovery phrases (e.g. in a 3-5 wallet: 1 wallet export file + 2 wallet recovery phrases of any of the other copayers).</span> <span translate><b>OR</b> 1 wallet export file and the remaining quorum of wallet recovery phrases (e.g. in a 3-5 wallet: 1 wallet export file + 2 wallet recovery phrases of any of the other copayers).</span>
</div> </div>
</span> </span>
</div> </div>
<div class="size-14 text-gray columns" ng-show="(index.n>1 && index.m == index.n )"> <div class="size-14 text-gray columns" ng-show="(wallet.n>1 && wallet.m == wallet.n )">
<span translate> <span translate>
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need To restore this {{wallet.m}}-{{wallet.n}} <b>shared</b> wallet you will need
</span>: </span>:
<div class="m10t columns size-14 text-gray"> <div class="m10t columns size-14 text-gray">
<span translate>Your wallet recovery phrase and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</span> <span translate>Your wallet recovery phrase and access to the server that coordinated the initial wallet creation. You still need {{wallet.m}} keys to spend.</span>
<span translate><b>OR</b> the wallet recovery phrases of <b>all</b> copayers in the wallet</span> <span translate><b>OR</b> the wallet recovery phrases of <b>all</b> copayers in the wallet</span>
</div> </div>
</span> </span>
@ -57,14 +63,14 @@
</div> </div>
<div ng-show="mnemonicWords || (!credentialsEncrypted && !deleted)"> <div ng-show="mnemonicWords || (!credentialsEncrypted && !deleted)">
<p class="text-center columns text-gray" ng-show="index.n==1 && step == 1"> <p class="text-center columns text-gray" ng-show="wallet.n==1 && step == 1">
<span translate> <span translate>
You need the wallet recovery phrase to restore this personal wallet. Write it down and keep them somewhere safe. You need the wallet recovery phrase to restore this personal wallet. Write it down and keep them somewhere safe.
</span> </span>
</p> </p>
<div class="row" ng-show="!credentialsEncrypted"> <div class="row" ng-show="!credentialsEncrypted">
<div class="columns"> <div class="columns">
<div class="panel" ng-class="{'enable_text_select': index.network == 'testnet'}"> <div class="panel" ng-class="{'enable_text_select': wallet.network == 'testnet'}">
<span ng-repeat="word in mnemonicWords track by $index"><span style="white-space:nowrap">{{word}}</span><span ng-show="useIdeograms">&#x3000;</span> </span> <span ng-repeat="word in mnemonicWords track by $index"><span style="white-space:nowrap">{{word}}</span><span ng-show="useIdeograms">&#x3000;</span> </span>
</div> </div>
</div> </div>

View file

@ -1,5 +1,5 @@
<ion-view ng-controller="exportController" cache-view="false" ng-init="init()"> <ion-view>
<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">
@ -8,25 +8,22 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header"> <ion-content ng-controller="exportController" cache-view="false" ng-init="init()">
<h4>{{wallet.name}}</h4>
<div ng-show="!canSign"><h4></h4></div> <div ng-show="!canSign"><h4></h4></div>
<div ng-show="canSign" class="create-tab small-only-text-center"> <div class="row" ng-show="canSign">
<div class="row"> <div class="col"
<div class="tab-container small-6 columns"
ng-class="{'selected':!exportQR}" ng-class="{'selected':!exportQR}"
ng-style="{'border-color':!exportQR ? index.backgroundColor: 'inherit'}" ng-style="{'border-color':!exportQR ? wallet.color: 'inherit'}"
ng-click="exportQR = false"> ng-click="exportQR = false">
<a href ng-style="{'color':!exportQR ? index.backgroundColor: 'inherit'}" translate>File/Text</a> <a class="button button-full button-clear" ng-style="{'color':!exportQR ? wallet.color: 'inherit'}" translate>File/Text</a>
</div> </div>
<div class="tab-container small-6 columns" <div class="col"
ng-class="{'selected':exportQR}" ng-class="{'selected':exportQR}"
ng-style="{'border-color':exportQR ? index.backgroundColor: 'inherit'}" ng-style="{'border-color':exportQR ? wallet.color: 'inherit'}"
ng-click="exportQR = true"> ng-click="exportQR = true">
<a href ng-style="{'color':exportQR ? index.backgroundColor: 'inherit'}" translate>QR Code</a> <a class="button button-full button-clear" ng-style="{'color':exportQR ? wallet.color: 'inherit'}" translate>QR Code</a>
</div> </div>
</div>
</div> </div>
<div ng-show="!backupWalletPlainText"> <div ng-show="!backupWalletPlainText">
@ -35,20 +32,15 @@
<span translate>Failed to export</span> <span translate>Failed to export</span>
</div> </div>
<form ng-show="!exportQR"> <form name="exportForm" ng-show="!exportQR" novalidate>
<div class="row"> <label class="item item-input item-stacked-label">
<div class="columns"> <span class="input-label" transalate>Set up a password</span>
<label for="password" translate>Set up a password </label> <input type="password" placeholder="{{'Your password'|translate}}" name="password" ng-model="password">
<div class="input"> </label>
<input type="password" class="form-control" placeholder="{{'Your password'|translate}}" name="password" ng-model="password"> <label class="item item-input item-stacked-label">
</div> <span class="input-label" transalate>Repeat the password</span>
<input type="password" class="form-control" placeholder="{{'Repeat password'|translate}}" name="password" ng-model="repeatpassword">
<label for="password" translate>Repeat the password</label> </label>
<div class="input">
<input type="password" class="form-control" placeholder="{{'Repeat password'|translate}}" name="password" ng-model="repeatpassword">
</div>
</div>
</div>
</form> </form>
<div class="m20t text-gray" ng-show="exportQR && supported"> <div class="m20t text-gray" ng-show="exportQR && supported">
@ -62,27 +54,18 @@
<div class="text-center size-12 m10" translate>Exporting via QR not supported for this wallet</div> <div class="text-center size-12 m10" translate>Exporting via QR not supported for this wallet</div>
</div> </div>
<div class="row" ng-show="!exportQR && canSign"> <ion-toggle ng-show="!exportQR && canSign" ng-model="showAdvanced" toggle-class="toggle-balanced">
<div class="columns m15t"> <span translate ng-show="!showAdvanced">Show advanced options</span>
<a class="button outline light-gray expand tiny p10i" ng-click="showAdvanced = !showAdvanced"> <span translate ng-show="showAdvanced">Hide advanced options</span>
<i class="fi-widget m3r"></i> </ion-toggle>
<span translate ng-hide="showAdvanced">Show advanced options</span>
<span translate ng-hide="!showAdvanced">Hide advanced options</span>
<i ng-if="!showAdvanced" class="icon-arrow-down4"></i>
<i ng-if="showAdvanced" class="icon-arrow-up4"></i>
</a>
</div>
</div>
<div ng-show="showAdvanced && !exportQR"> <ion-toggle ng-model="noSignEnabled" ng-show="showAdvanced && !exportQR" toggle-class="toggle-balanced" class="r0" ng-change="noSignEnabledChange()">
<ion-toggle ng-model="noSignEnabled" toggle-class="toggle-balanced" class="r0" ng-change="noSignEnabledChange()"> <span class="toggle-label" translate>Do not include private key</span>
<span class="toggle-label" translate>Do not include private key</span> </ion-toggle>
</ion-toggle>
</div>
<div class="box-notification p15l" ng-show="!canSign"> <div class="box-notification p15l" ng-show="!canSign">
<span class="text-warning size-14"> <span class="text-warning size-14">
<i class="fi-alert"></i> <i class="ion-alert-circled"></i>
<span translate> <span translate>
WARNING: The private key of this wallet is not available. The export allows to check the wallet balance, transaction history, and create spend proposals from the export. However, does not allow to approve (sign) proposals, so <b>funds will not be accessible from the export</b>. WARNING: The private key of this wallet is not available. The export allows to check the wallet balance, transaction history, and create spend proposals from the export. However, does not allow to approve (sign) proposals, so <b>funds will not be accessible from the export</b>.
</span> </span>
@ -91,37 +74,44 @@
<div class="box-notification p15l" ng-show="noSignEnabled && !exportQR"> <div class="box-notification p15l" ng-show="noSignEnabled && !exportQR">
<span class="text-warning size-14"> <span class="text-warning size-14">
<i class="fi-alert"></i> <i class="ion-alert-circled"></i>
<span translate> <span translate>
WARNING: Not including the private key allows to check the wallet balance, transaction history, and create spend proposals from the export. However, does not allow to approve (sign) proposals, so <b>funds will not be accessible from the export</b>. WARNING: Not including the private key allows to check the wallet balance, transaction history, and create spend proposals from the export. However, does not allow to approve (sign) proposals, so <b>funds will not be accessible from the export</b>.
</span> </span>
</span> </span>
</div> </div>
<div class="row" ng-show="!exportQR"> <button ng-show="!exportQR"
<div class="columns"> ng-click="downloadWalletBackup()"
<button class="black round expand m20t" ng-click="downloadWalletBackup()" class="button button-block button-positive"
ng-disabled="(!password || password != repeatpassword)" ng-disabled="(!password || password != repeatpassword)"
ng-style="{'background-color':wallet.color}" ng-style="{'background-color':wallet.color}"
ng-show="!isSafari && !isCordova"><i class="fi-download"></i> ng-show="!isSafari && !isCordova">
<span translate>Download</span></button> <i class="fi-download"></i>
<button class="black round expand m20t" ng-click="viewWalletBackup()" <span translate>Download</span>
ng-disabled="(!password || password != repeatpassword)" </button>
ng-style="{'background-color':wallet.color}"
ng-show="isSafari && !isCordova"><i class="fi-eye"></i> <button ng-show="!exportQR"
<span translate>View</span></button> ng-click="viewWalletBackup()"
<div ng-show="isCordova"> class="button button-block button-positive"
<h4 translate>Export options</h4> ng-disabled="(!password || password != repeatpassword)"
<button class="black round expand" ng-disabled="(!password || password != repeatpassword)" ng-style="{'background-color':wallet.color}"
ng-style="{'background-color':index.backgroundColor}" ng-show="isSafari && !isCordova">
ng-click="copyWalletBackup()"><i class="fi-clipboard-pencil"></i> <i class="fi-eye"></i>
<span translate>Copy to clipboard</span></button> <span translate>View</span>
<button class="black round expand" ng-disabled="(!password || password != repeatpassword)" </button>
ng-style="{'background-color':index.backgroundColor}" <div ng-show="isCordova">
ng-click="sendWalletBackup()"><i class="fi-mail"></i> <h4 translate>Export options</h4>
<span translate>Send by email</span></button> <button class="button button-block button-positive"
</div> ng-disabled="(!password || password != repeatpassword)"
</div> ng-style="{'background-color':index.backgroundColor}"
ng-click="copyWalletBackup()">
<i class="fi-clipboard-pencil"></i>
<span translate>Copy to clipboard</span></button>
<button class="button button-block button-positive" ng-disabled="(!password || password != repeatpassword)"
ng-style="{'background-color':index.backgroundColor}"
ng-click="sendWalletBackup()"><i class="fi-mail"></i>
<span translate>Send by email</span></button>
</div> </div>
</div> </div>

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesController" cache-view="false" ng-init="init()"> <ion-content ng-controller="preferencesController" cache-view="false" ng-init="init()">
<div class="list"> <div class="list">
<div class="item item-divider"> <div class="item item-divider">
Preferences Preferences

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header"> <ion-content>
<div class="list"> <div class="list">
<div class="item item-divider"> <div class="item item-divider">
</div> </div>

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesAliasController" cache-view="false"> <ion-content ng-controller="preferencesAliasController" cache-view="false">
<form name="aliasForm" ng-submit="save(aliasForm)" novalidate> <form name="aliasForm" ng-submit="save(aliasForm)" novalidate>
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label" transalate>Alias for {{walletName}}</span> <span class="input-label" transalate>Alias for {{walletName}}</span>

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesBwsUrlController" cache-view="false"> <ion-content ng-controller="preferencesBwsUrlController" cache-view="false">
<form name="settingsBwsUrlForm" ng-submit="save(settingsBwsUrlForm)" novalidate> <form name="settingsBwsUrlForm" ng-submit="save(settingsBwsUrlForm)" novalidate>
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label" transalate>Wallet Service URL</span><a ng-click="resetDefaultUrl()" translate> Set default url</a> <span class="input-label" transalate>Wallet Service URL</span><a ng-click="resetDefaultUrl()" translate> Set default url</a>

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesColorController" cache-view="false"> <ion-content ng-controller="preferencesColorController" cache-view="false">
<ion-radio ng-repeat="c in colorList" ng-value="c" ng-model="currentColor" ng-click="save(c)"> <ion-radio ng-repeat="c in colorList" ng-value="c" ng-model="currentColor" ng-click="save(c)">
<span ng-style="{'color': c}">&block;</span> <span ng-style="{'color': c}">&block;</span>
</ion-radio> </ion-radio>

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesDeleteWordsController" cache-view="false"> <ion-content ng-controller="preferencesDeleteWordsController" cache-view="false">
<div ng-show="!deleted"> <div ng-show="!deleted">
<div ng-show="error"> <div ng-show="error">
{{error|translate}} {{error|translate}}

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesEmailController" cache-view="false"> <ion-content ng-controller="preferencesEmailController" cache-view="false">
<form name="emailForm" ng-submit="save(emailForm)" novalidate> <form name="emailForm" ng-submit="save(emailForm)" novalidate>
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
<span class="input-label" transalate>Email for wallet notifications</span> <span class="input-label" transalate>Email for wallet notifications</span>

View file

@ -5,7 +5,7 @@
<div class="content preferences" ng-controller="preferencesGlobalController" ng-init="init()"> <div class="content preferences" ng-controller="preferencesGlobalController" ng-init="init()">
<h4></h4> <h4></h4>
<ul class="no-bullet m0"> <ul>
<li href ui-sref="preferencesLanguage"> <li href ui-sref="preferencesLanguage">
<div class="right text-gray"> <div class="right text-gray">
{{currentLanguageName|translate}} {{currentLanguageName|translate}}

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesHistory" cache-view="false" ng-init="index.updatingTxHistory ? null : csvHistory()"> <ion-content ng-controller="preferencesHistory" cache-view="false" ng-init="index.updatingTxHistory ? null : csvHistory()">
<div class="item item-divider"></div> <div class="item item-divider"></div>
<div class="item" ng-show="csvReady && !index.isCordova" ng-csv="csvContent" csv-header="csvHeader" filename="Copay-{{index.alias || index.walletName}}.csv"> <div class="item" ng-show="csvReady && !index.isCordova" ng-csv="csvContent" csv-header="csvHeader" filename="Copay-{{index.alias || index.walletName}}.csv">
<span translate>Export to file</span> <span translate>Export to file</span>

View file

@ -7,7 +7,7 @@
</button> </button>
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="preferencesInformation" cache-view="false" ng-init="init()"> <ion-content ng-controller="preferencesInformation" cache-view="false" ng-init="init()">
<div class="list"> <div class="list">
<div class="item item-divider"> <div class="item item-divider">
Wallet Information Wallet Information

View file

@ -2,7 +2,7 @@
<ion-nav-bar class="bar-stable"> <ion-nav-bar class="bar-stable">
<ion-nav-title>Global Settings</ion-nav-title> <ion-nav-title>Global Settings</ion-nav-title>
</ion-nav-bar> </ion-nav-bar>
<ion-content class="has-header" ng-controller="tabSettingsController" cache-view="false" ng-init="init()"> <ion-content ng-controller="tabSettingsController" cache-view="false" ng-init="init()">
<div class="item item-divider"> <div class="item item-divider">
</div> </div>
<div class="list"> <div class="list">

View file

@ -13,7 +13,7 @@
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content ng-controller="walletDetailsController" ng-init="init()" cache-view="false" class="has-header" delegate-handle="my-handle" overflow-scroll="true"> <ion-content ng-controller="walletDetailsController" ng-init="init()" cache-view="false" delegate-handle="my-handle" overflow-scroll="true">
<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,30 +1,28 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('backupController', angular.module('copayApp.controllers').controller('backupController',
function($rootScope, $scope, $timeout, $log, $state, lodash, fingerprintService, platformInfo, configService, profileService, gettext, bwcService, walletService, ongoingProcess) { function($rootScope, $scope, $timeout, $log, $state, $stateParams, lodash, fingerprintService, platformInfo, configService, profileService, gettext, bwcService, walletService, ongoingProcess) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var prevState;
$scope.customWords = []; $scope.customWords = [];
$scope.walletName = fc.credentials.walletName; $scope.walletName = wallet.credentials.walletName;
$scope.credentialsEncrypted = fc.isPrivKeyEncrypted; $scope.credentialsEncrypted = wallet.isPrivKeyEncrypted;
$scope.init = function(state) { $scope.init = function() {
prevState = state || 'walletHome';
$scope.step = 1; $scope.step = 1;
$scope.deleted = isDeletedSeed(); $scope.deleted = isDeletedSeed();
if ($scope.deleted) return; if ($scope.deleted) return;
fingerprintService.check(fc, function(err) { fingerprintService.check(wallet, function(err) {
if (err) { if (err) {
go.path(prevState); $state.transitionTo('preferences');
return; return;
} }
handleEncryptedWallet(fc, function(err) { handleEncryptedWallet(wallet, function(err) {
if (err) { if (err) {
$log.warn('Error decrypting credentials:', $scope.error); $log.warn('Error decrypting credentials:', $scope.error);
go.path(prevState); $state.transitionTo('preferences');
return; return;
} }
$scope.credentialsEncrypted = false; $scope.credentialsEncrypted = false;
@ -45,11 +43,11 @@ angular.module('copayApp.controllers').controller('backupController',
}; };
$scope.initFlow = function() { $scope.initFlow = function() {
var words = fc.getMnemonic(); var words = wallet.getMnemonic();
$scope.xPrivKey = fc.credentials.xPrivKey; $scope.xPrivKey = wallet.credentials.xPrivKey;
$scope.mnemonicWords = words.split(/[\u3000\s]+/); $scope.mnemonicWords = words.split(/[\u3000\s]+/);
$scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords); $scope.shuffledMnemonicWords = shuffledWords($scope.mnemonicWords);
$scope.mnemonicHasPassphrase = fc.mnemonicHasPassphrase(); $scope.mnemonicHasPassphrase = wallet.mnemonicHasPassphrase();
$scope.useIdeograms = words.indexOf("\u3000") >= 0; $scope.useIdeograms = words.indexOf("\u3000") >= 0;
$scope.passphrase = ''; $scope.passphrase = '';
$scope.customWords = []; $scope.customWords = [];
@ -63,17 +61,13 @@ angular.module('copayApp.controllers').controller('backupController',
}; };
function isDeletedSeed() { function isDeletedSeed() {
if (lodash.isEmpty(fc.credentials.mnemonic) && lodash.isEmpty(fc.credentials.mnemonicEncrypted)) if (lodash.isEmpty(wallet.credentials.mnemonic) && lodash.isEmpty(wallet.credentials.mnemonicEncrypted))
return true; return true;
return false; return false;
}; };
$scope.goBack = function() {
$state.go('wallet.preferences');
};
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
walletService.lock(fc); walletService.lock(wallet);
}); });
$scope.goToStep = function(n) { $scope.goToStep = function(n) {
@ -147,9 +141,9 @@ angular.module('copayApp.controllers').controller('backupController',
try { try {
walletClient.seedFromMnemonic(customSentence, { walletClient.seedFromMnemonic(customSentence, {
network: fc.credentials.network, network: wallet.credentials.network,
passphrase: passphrase, passphrase: passphrase,
account: fc.credentials.account account: wallet.credentials.account
}); });
} catch (err) { } catch (err) {
return cb(err); return cb(err);

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('copayersController', angular.module('copayApp.controllers').controller('copayersController',
function($scope, $rootScope, $timeout, $log, $ionicModal, profileService, go, notification, platformInfo, gettext, gettextCatalog, $stateParams, $state) { function($scope, $rootScope, $timeout, $log, $ionicModal, $stateParams, profileService, go, notification, platformInfo, gettext, gettextCatalog, $state) {
var self = this; var self = this;
$scope.isCordova = platformInfo.isCordova; $scope.isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
@ -30,9 +30,9 @@ angular.module('copayApp.controllers').controller('copayersController',
}; };
var doDeleteWallet = function() { var doDeleteWallet = function() {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var walletName = fc.credentials.walletName; var walletName = wallet.credentials.walletName;
profileService.deleteWalletClient(fc, function(err) { profileService.deleteWalletClient(wallet, function(err) {
if (err) { if (err) {
self.error = err.message || err; self.error = err.message || err;
$timeout(function() { $timeout(function() {
@ -53,7 +53,7 @@ angular.module('copayApp.controllers').controller('copayersController',
}; };
$scope.deleteWallet = function() { $scope.deleteWallet = function() {
var fc = profileService.focusedClient; var wallet = profileService.focusedClient;
if ($scope.isCordova) { if ($scope.isCordova) {
navigator.notification.confirm( navigator.notification.confirm(
delete_msg, delete_msg,
@ -86,18 +86,18 @@ angular.module('copayApp.controllers').controller('copayersController',
}; };
if (!$stateParams.walletId) { if (!$stateParams.walletId) {
$log.debug('No wallet provided...back to home'); $log.debug('No wallet provided...back to home');
return $state.transitionTo('tabs.home') return $state.transitionTo('tabs.home')
} }
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var secret; var secret;
try { try {
secret = wallet.status.wallet.secret; secret = wallet.status.wallet.secret;
} catch (e) {}; } catch (e) {};
$scope.wallet = wallet; $scope.wallet = wallet;
$scope.secret = secret; $scope.secret = secret;
}); });

View file

@ -75,7 +75,7 @@ angular.module('copayApp.controllers').controller('exportController',
}; };
$scope.getAddressbook = function(cb) { $scope.getAddressbook = function(cb) {
storageService.getAddressbook(fc.credentials.network, function(err, addressBook) { storageService.getAddressbook(wallet.credentials.network, function(err, addressBook) {
if (err) return cb(err); if (err) return cb(err);
var localAddressBook = []; var localAddressBook = [];

View file

@ -1,17 +1,17 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService) { angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService) {
var self = $scope.self; var self = $scope.self;
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var config = configService.getSync(); var config = configService.getSync();
var configWallet = config.wallet; var configWallet = config.wallet;
var walletSettings = configWallet.settings; var walletSettings = configWallet.settings;
$scope.alternativeIsoCode = walletSettings.alternativeIsoCode; $scope.alternativeIsoCode = walletSettings.alternativeIsoCode;
$scope.color = fc.backgroundColor; $scope.color = wallet.color;
$scope.copayerId = fc.credentials.copayerId; $scope.copayerId = wallet.credentials.copayerId;
$scope.isShared = fc.credentials.n > 1; $scope.isShared = wallet.credentials.n > 1;
$scope.btx.amountStr = txFormatService.formatAmount($scope.btx.amount, true) + ' ' + walletSettings.unitName; $scope.btx.amountStr = txFormatService.formatAmount($scope.btx.amount, true) + ' ' + walletSettings.unitName;
$scope.btx.feeStr = txFormatService.formatAmount($scope.btx.fees, true) + ' ' + walletSettings.unitName; $scope.btx.feeStr = txFormatService.formatAmount($scope.btx.fees, true) + ' ' + walletSettings.unitName;
@ -40,7 +40,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
args.body = $scope.data.comment; args.body = $scope.data.comment;
}; };
fc.editTxNote(args, function(err) { wallet.editTxNote(args, function(err) {
if (err) { if (err) {
$log.debug('Could not save tx comment'); $log.debug('Could not save tx comment');
return; return;
@ -50,7 +50,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
if (args.body) { if (args.body) {
$scope.btx.note = {}; $scope.btx.note = {};
$scope.btx.note.body = $scope.data.comment; $scope.btx.note.body = $scope.data.comment;
$scope.btx.note.editedByName = fc.credentials.copayerName; $scope.btx.note.editedByName = wallet.credentials.copayerName;
$scope.btx.note.editedOn = Math.floor(Date.now() / 1000); $scope.btx.note.editedOn = Math.floor(Date.now() / 1000);
} }
$scope.btx.searcheableString = null; $scope.btx.searcheableString = null;
@ -62,7 +62,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.getAlternativeAmount = function() { $scope.getAlternativeAmount = function() {
var satToBtc = 1 / 100000000; var satToBtc = 1 / 100000000;
fc.getFiatRate({ wallet.getFiatRate({
code: $scope.alternativeIsoCode, code: $scope.alternativeIsoCode,
ts: $scope.btx.time * 1000 ts: $scope.btx.time * 1000
}, function(err, res) { }, function(err, res) {
@ -81,7 +81,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
}; };
$scope.getShortNetworkName = function() { $scope.getShortNetworkName = function() {
var n = fc.credentials.network; var n = wallet.credentials.network;
return n.substring(0, 4); return n.substring(0, 4);
}; };

View file

@ -1,7 +1,7 @@
angular.module('copayApp.controllers').controller('paperWalletController', angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $timeout, $log, $ionicModal, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess, txFormatService) { function($scope, $timeout, $log, $ionicModal, $stateParams, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess, txFormatService) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var rawTx; var rawTx;
$scope.onQrCodeScanned = function(data) { $scope.onQrCodeScanned = function(data) {
@ -18,11 +18,11 @@ angular.module('copayApp.controllers').controller('paperWalletController',
function _scanFunds(cb) { function _scanFunds(cb) {
function getPrivateKey(scannedKey, isPkEncrypted, passphrase, cb) { function getPrivateKey(scannedKey, isPkEncrypted, passphrase, cb) {
if (!isPkEncrypted) return cb(null, scannedKey); if (!isPkEncrypted) return cb(null, scannedKey);
fc.decryptBIP38PrivateKey(scannedKey, passphrase, null, cb); wallet.decryptBIP38PrivateKey(scannedKey, passphrase, null, cb);
}; };
function getBalance(privateKey, cb) { function getBalance(privateKey, cb) {
fc.getBalanceFromPrivateKey(privateKey, cb); wallet.getBalanceFromPrivateKey(privateKey, cb);
}; };
function checkPrivateKey(privateKey) { function checkPrivateKey(privateKey) {
@ -70,13 +70,13 @@ angular.module('copayApp.controllers').controller('paperWalletController',
}; };
function _sweepWallet(cb) { function _sweepWallet(cb) {
addressService.getAddress(fc.credentials.walletId, true, function(err, destinationAddress) { addressService.getAddress(wallet.credentials.walletId, true, function(err, destinationAddress) {
if (err) return cb(err); if (err) return cb(err);
fc.buildTxFromPrivateKey($scope.privateKey, destinationAddress, null, function(err, tx) { wallet.buildTxFromPrivateKey($scope.privateKey, destinationAddress, null, function(err, tx) {
if (err) return cb(err); if (err) return cb(err);
fc.broadcastRawTx({ wallet.broadcastRawTx({
rawTx: tx.serialize(), rawTx: tx.serialize(),
network: 'livenet' network: 'livenet'
}, function(err, txid) { }, function(err, txid) {
@ -113,7 +113,7 @@ angular.module('copayApp.controllers').controller('paperWalletController',
$scope.openStatusModal = function(type, txp, cb) { $scope.openStatusModal = function(type, txp, cb) {
$scope.type = type; $scope.type = type;
$scope.tx = txFormatService.processTx(txp); $scope.tx = txFormatService.processTx(txp);
$scope.color = fc.backgroundColor; $scope.color = wallet.backgroundColor;
$scope.cb = cb; $scope.cb = cb;
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', { $ionicModal.fromTemplateUrl('views/modals/tx-status.html', {

View file

@ -11,7 +11,6 @@ angular.module('copayApp.controllers').controller('preferencesController',
$scope.externalSource = null; $scope.externalSource = null;
if (wallet) { if (wallet) {
walletService.getStatus(wallet, {}, function(err, status) {});
var config = configService.getSync(); var config = configService.getSync();
config.aliasFor = config.aliasFor || {}; config.aliasFor = config.aliasFor || {};
$scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName; $scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;

View file

@ -1,12 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesBwsUrlController', angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
function($scope, $log, configService, applicationService, profileService, storageService) { function($scope, $log, $stateParams, configService, applicationService, profileService, storageService) {
$scope.error = null; $scope.error = null;
$scope.success = null; $scope.success = null;
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var walletId = fc.credentials.walletId; var walletId = wallet.credentials.walletId;
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
var config = configService.getSync(); var config = configService.getSync();

View file

@ -1,9 +1,10 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesHistory', angular.module('copayApp.controllers').controller('preferencesHistory',
function($scope, $log, $timeout, storageService, go, profileService, lodash) { function($scope, $log, $stateParams, $timeout, storageService, go, profileService, lodash) {
var fc = profileService.focusedClient;
var c = fc.credentials; var wallet = profileService.getWallet($stateParams.walletId);
var c = wallet.credentials;
$scope.csvReady = false; $scope.csvReady = false;
$scope.csvHistory = function(cb) { $scope.csvHistory = function(cb) {
@ -125,7 +126,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
$scope.$emit('Local/ClearHistory'); $scope.$emit('Local/ClearHistory');
$timeout(function() { $timeout(function() {
go.walletHome(); go.choosedWallet(c.walletId);
}, 100); }, 100);
}); });
}; };

View file

@ -13,8 +13,8 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.openSearchModal = function() { $scope.openSearchModal = function() {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
$scope.color = fc.backgroundColor; $scope.color = wallet.color;
$scope.self = self; $scope.self = self;
$ionicModal.fromTemplateUrl('views/modals/search.html', { $ionicModal.fromTemplateUrl('views/modals/search.html', {

View file

@ -190,17 +190,17 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
templateUrl: 'views/copayers.html' templateUrl: 'views/copayers.html'
}) })
// OLD // OLD
// .state('walletHome', { // .state('walletHome', {
// url: '/old', // url: '/old',
// needProfile: true, // needProfile: true,
// views: { // views: {
// 'main': { // 'main': {
// templateUrl: 'views/walletHome.html', // templateUrl: 'views/walletHome.html',
// }, // },
// } // }
// }) // })
.state('tabs', { .state('tabs', {
url: '/tabs', url: '/tabs',
cache: false, cache: false,
needProfile: true, needProfile: true,
@ -280,7 +280,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}, },
}) })
.state('unsupported', { .state('unsupported', {
url: '/unsupported', url: '/unsupported',
needProfile: false, needProfile: false,
views: { views: {
@ -697,7 +697,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} else { } else {
profileService.storeProfileIfDirty(); profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.'); $log.debug('Profile loaded ... Starting UX.');
$state.transitionTo('tabs.home'); // $state.transitionTo('tabs.home');
} }
}); });

View file

@ -1,11 +1,11 @@
'use strict'; 'use strict';
angular.module('copayApp.services').factory('addressbookService', function(storageService, profileService, lodash) { angular.module('copayApp.services').factory('addressbookService', function($stateParams, storageService, profileService, lodash) {
var root = {}; var root = {};
root.getLabel = function(addr, cb) { root.getLabel = function(addr, cb) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
storageService.getAddressbook(fc.credentials.network, function(err, ab) { storageService.getAddressbook(wallet.credentials.network, function(err, ab) {
if (!ab) return cb(); if (!ab) return cb();
if (ab[addr]) return cb(ab[addr]); if (ab[addr]) return cb(ab[addr]);
else return cb(); else return cb();
@ -23,19 +23,19 @@ angular.module('copayApp.services').factory('addressbookService', function(stora
if (ab2) ab2 = JSON.parse(ab2); if (ab2) ab2 = JSON.parse(ab2);
ab2 = ab2 || {}; ab2 = ab2 || {};
return cb(err, lodash.defaults(ab2,ab)); return cb(err, lodash.defaults(ab2, ab));
}); });
}); });
}; };
root.add = function(entry, cb) { root.add = function(entry, cb) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
root.list(function(err, ab) { root.list(function(err, ab) {
if (err) return cb(err); if (err) return cb(err);
if (!ab) ab = {}; if (!ab) ab = {};
if (ab[entry.address]) return cb('Entry already exist'); if (ab[entry.address]) return cb('Entry already exist');
ab[entry.address] = entry.label; ab[entry.address] = entry.label;
storageService.setAddressbook(fc.credentials.network, JSON.stringify(ab), function(err, ab) { storageService.setAddressbook(wallet.credentials.network, JSON.stringify(ab), function(err, ab) {
if (err) return cb('Error adding new entry'); if (err) return cb('Error adding new entry');
root.list(function(err, ab) { root.list(function(err, ab) {
return cb(err, ab); return cb(err, ab);
@ -45,13 +45,13 @@ angular.module('copayApp.services').factory('addressbookService', function(stora
}; };
root.remove = function(addr, cb) { root.remove = function(addr, cb) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
root.list(function(err, ab) { root.list(function(err, ab) {
if (err) return cb(err); if (err) return cb(err);
if (!ab) return; if (!ab) return;
if (!ab[addr]) return cb('Entry does not exist'); if (!ab[addr]) return cb('Entry does not exist');
delete ab[addr]; delete ab[addr];
storageService.setAddressbook(fc.credentials.network, JSON.stringify(ab), function(err) { storageService.setAddressbook(wallet.credentials.network, JSON.stringify(ab), function(err) {
if (err) return cb('Error deleting entry'); if (err) return cb('Error deleting entry');
root.list(function(err, ab) { root.list(function(err, ab) {
return cb(err, ab); return cb(err, ab);
@ -61,8 +61,8 @@ angular.module('copayApp.services').factory('addressbookService', function(stora
}; };
root.removeAll = function() { root.removeAll = function() {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
storageService.removeAddressbook(fc.credentials.network, function(err) { storageService.removeAddressbook(wallet.credentials.network, function(err) {
if (err) return cb('Error deleting addressbook'); if (err) return cb('Error deleting addressbook');
return cb(); return cb();
}); });

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.services') angular.module('copayApp.services')
.factory('backupService', function backupServiceFactory($log, $timeout, profileService, sjcl) { .factory('backupService', function backupServiceFactory($log, $timeout, $stateParams, profileService, sjcl) {
var root = {}; var root = {};
@ -57,10 +57,10 @@ angular.module('copayApp.services')
if (!password) { if (!password) {
return null; return null;
} }
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
try { try {
opts = opts || {}; opts = opts || {};
var b = fc.export(opts); var b = wallet.export(opts);
if (opts.addressBook) b = root.addMetadata(b, opts); if (opts.addressBook) b = root.addMetadata(b, opts);
var e = sjcl.encrypt(password, b, { var e = sjcl.encrypt(password, b, {
@ -74,11 +74,11 @@ angular.module('copayApp.services')
}; };
root.walletDownload = function(password, opts, cb) { root.walletDownload = function(password, opts, cb) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var ew = root.walletExport(password, opts); var ew = root.walletExport(password, opts);
if (!ew) return cb('Could not create backup'); if (!ew) return cb('Could not create backup');
var walletName = (fc.alias || '') + (fc.alias ? '-' : '') + fc.credentials.walletName; var walletName = (wallet.alias || '') + (wallet.alias ? '-' : '') + wallet.credentials.walletName;
if (opts.noSign) walletName = walletName + '-noSign' if (opts.noSign) walletName = walletName + '-noSign'
var filename = walletName + '-Copaybackup.aes.json'; var filename = walletName + '-Copaybackup.aes.json';
_download(ew, filename, cb) _download(ew, filename, cb)

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.services').factory('feeService', function($log, bwcService, walletService, configService, gettext, lodash, txFormatService) { angular.module('copayApp.services').factory('feeService', function($log, $stateParams, bwcService, walletService, configService, gettext, lodash, txFormatService) {
var root = {}; var root = {};
// Constant fee options to translate // Constant fee options to translate
@ -16,12 +16,12 @@ angular.module('copayApp.services').factory('feeService', function($log, bwcServ
}; };
root.getCurrentFeeValue = function(cb) { root.getCurrentFeeValue = function(cb) {
console.log('[feeService.js.18:getCurrentFeeValue:] TODO TODO TODO'); //TODO console.log('[feeService.js.18:getCurrentFeeValue:] TODO TODO TODO'); //TODO
// TODO TODO TODO // TODO TODO TODO
var fc = walletService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var feeLevel = root.getCurrentFeeLevel(); var feeLevel = root.getCurrentFeeLevel();
fc.getFeeLevels(fc.credentials.network, function(err, levels) { wallet.getFeeLevels(wallet.credentials.network, function(err, levels) {
if (err) if (err)
return cb({ return cb({
message: 'Could not get dynamic fee' message: 'Could not get dynamic fee'

View file

@ -5,7 +5,7 @@ angular.module('copayApp.services').factory('txStatus', function(lodash, profile
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
root.notify = function(txp) { root.notify = function(txp) {
var fc = profileService.focusedClient; var wallet = profileService.getWallet($stateParams.walletId);
var status = txp.status; var status = txp.status;
var type; var type;
var INMEDIATE_SECS = 10; var INMEDIATE_SECS = 10;
@ -16,7 +16,7 @@ angular.module('copayApp.services').factory('txStatus', function(lodash, profile
var n = txp.actions.length; var n = txp.actions.length;
var action = lodash.find(txp.actions, { var action = lodash.find(txp.actions, {
copayerId: fc.credentials.copayerId copayerId: wallet.credentials.copayerId
}); });
if (!action) { if (!action) {