Merge pull request #872 from cmgustavo/bug/01-config-storage

Fixes: save config in localStorage
This commit is contained in:
Matias Alejo Garcia 2014-07-08 21:00:03 -03:00
commit 27e27af7ab
3 changed files with 11 additions and 7 deletions

View File

@ -857,13 +857,14 @@
<div class="small-12 medium-6 medium-centered large-6 large-centered columns">
<fieldset>
<legend>Bitcoin Network</legend>
<div ng-if="!forceNetwork">
<input id="network-name" type="checkbox" ng-model="networkName"
ng-true-value="livenet" ng-false-value="testnet" class="form-control" ng-click="changeNetwork()">
ng-true-value="livenet" ng-false-value="testnet" class="form-control" ng-click="changeNetwork()"
ng-disabled="forceNetwork"
ng-checked="networkName == 'livenet' ? true : false">
<label for="network-name">Livenet</label>
</div>
<div ng-if="forceNetwork">
Network has been fixed to <strong>{{networkName}}</strong> in this setup. See <a href="https://copay.io">copay.io</a>
<div ng-show="forceNetwork">
Network has been fixed to
<strong>{{networkName}}</strong> in this setup. See <a href="https://copay.io">copay.io</a>
for options to use Copay on both livenet and testnet.
</div>
</fieldset>

View File

@ -7,6 +7,9 @@ if (localConfig) {
var count = 0;
for (name in localConfig) {
if (localConfig.hasOwnProperty(name)) {
if (name === 'networkName' && config['forceNetwork']) {
continue;
}
config[name] = localConfig[name];
}
}

View File

@ -34,9 +34,9 @@ function Wallet(opts) {
throw new Error('missing required option for Wallet: ' + k);
self[k] = opts[k];
});
if (copayConfig.forceNetwork && opts.networkName !== copayConfig.networkName)
if (copayConfig.forceNetwork && this.getNetworkName() !== copayConfig.networkName)
throw new Error('Network forced to '+copayConfig.networkName+
' and tried to create a Wallet with network '+opts.networkName);
' and tried to create a Wallet with network '+ this.getNetworkName());
this.log('creating ' + opts.requiredCopayers + ' of ' + opts.totalCopayers + ' wallet');