add bws settings in join wallet

This commit is contained in:
Javier 2015-10-16 13:00:41 -03:00
commit a75bbe6e45
2 changed files with 28 additions and 6 deletions

View file

@ -77,6 +77,13 @@
</a> </a>
<div ng-show="join.hideAdv" class="row"> <div ng-show="join.hideAdv" class="row">
<div class="large-12 columns"> <div class="large-12 columns">
<label for="bws" class="oh">
<span translate>Specify Bitcore Wallet Service URL
<input type="text" id="bwsurl" type="text" name="bwsurl" ng-model="bwsurl">
</span>
</label>
<label for="hw-ledger" class="oh" ng-show="index.isChromeApp"> <label for="hw-ledger" class="oh" ng-show="index.isChromeApp">
<span translate>Use Ledger hardware wallet</span> <span translate>Use Ledger hardware wallet</span>
<switch id="hw-ledger" name="hwLedger" ng-model="hwLedger" class="green right m5t m10b"></switch> <switch id="hw-ledger" name="hwLedger" ng-model="hwLedger" class="green right m5t m10b"></switch>

View file

@ -1,9 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('joinController', angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, go, notification, profileService, isCordova, $modal, gettext, lodash, ledger, trezor) { function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, $modal, gettext, lodash, ledger, trezor) {
var self = this; var self = this;
var defaults = configService.getDefaults();
var defaults = configService.getDefaults();
$scope.bwsurl = defaults.bws.url;
this.onQrCodeScanned = function(data) { this.onQrCodeScanned = function(data) {
$scope.secret = data; $scope.secret = data;
@ -72,6 +75,18 @@ angular.module('copayApp.controllers').controller('joinController',
} }
$timeout(function() { $timeout(function() {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
var opts_ = {
bws: {}
};
opts_.bws[fc.credentials.walletId] = $scope.bwsurl;
configService.set(opts_, function(err) {
if (err) console.log(err);
$scope.$emit('Local/BWSUpdated');
applicationService.restart();
});
if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey)) { if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey)) {
$rootScope.$emit('Local/WalletImported', fc.credentials.walletId); $rootScope.$emit('Local/WalletImported', fc.credentials.walletId);
} else { } else {