Merge pull request #787 from matiu/bug/settings

Bug/settings
This commit is contained in:
Gustavo Maximiliano Cortez 2014-06-27 17:42:35 -03:00
commit c745aa8c3e
4 changed files with 18 additions and 17 deletions

View File

@ -28,8 +28,11 @@ var defaultConfig = {
key: 'satoshirocks',
host: '162.242.219.26',
port: 10000,
path: '/',
secure: false,
// host: 'copay.io',
// port: 9000,
// secure: true,
path: '/',
// other PeerJS config
maxPeers: 15,
@ -118,6 +121,6 @@ var defaultConfig = {
// theme list
themes: ['default'],
disableVideo: 1,
disableVideo: true,
verbose: 1,
};

View File

@ -820,7 +820,7 @@
<div class="small-12 medium-6 medium-centered large-6 large-centered columns">
<fieldset>
<legend>Bitcoin Network</legend>
<input id="network-name" type="checkbox" ng-model="networkName" ng-true-value="livenet" ng-false-value="testnet" class="form-control">
<input id="network-name" type="checkbox" ng-model="networkName" ng-true-value="livenet" ng-false-value="testnet" class="form-control" ng-click="changeNetwork()">
<label for="network-name">Livenet</label>
</fieldset>
<fieldset>
@ -832,7 +832,7 @@
<fieldset>
<legend>Videoconferencing</legend>
<input id="disableVideo-opt" type="checkbox" ng-model="disableVideo" class="form-control">
<label for="disableVideo-opt">Enable videoconferencing (only for fast Networks)</label>
<label for="disableVideo-opt">Disable videoconferencing (for slow networks)</label>
</fieldset>
<fieldset>
<legend>Insight API server</legend>
@ -840,7 +840,7 @@
<input type="text" ng-model="insightHost" class="form-control" name="insight-host">
<label for="insight-port">Port</label>
<input type="number" ng-model="insightPort" class="form-control" name="insight-port">
<input id="insight-secure" type="checkbox" ng-model="insightSecure" class="form-control">
<input id="insight-secure" type="checkbox" ng-model="insightSecure" class="form-control" ng-click="changeInsightSSL()">
<label for="insight-secure">Use SSL</label>
</fieldset>
@ -852,8 +852,8 @@
<input type="text" ng-model="networkHost" class="form-control" name="peerjs-host">
<label for="peerjs-port">Port</label>
<input type="number" ng-model="networkPort" class="form-control" name="peerjs-port">
<input id="peerjs-secure" type="checkbox" ng-model="networkSecure" class="form-control" disabled="disabled">
<label for="peerjs-secure">Use SSL (disabled)</label>
<input id="peerjs-secure" type="checkbox" ng-model="networkSecure" class="form-control">
<label for="peerjs-secure">Use SSL</label>
</fieldset>
</div>
<div class="row">

View File

@ -3,7 +3,6 @@
angular.module('copayApp.controllers').controller('SettingsController',
function($scope, $rootScope, $window, $location) {
$scope.title = 'Settings';
$scope.networkName = config.networkName;
$scope.insightHost = config.blockchain.host;
$scope.insightPort = config.blockchain.port;
@ -12,7 +11,7 @@ angular.module('copayApp.controllers').controller('SettingsController',
$scope.networkHost = config.network.host;
$scope.networkPort = config.network.port;
$scope.networkSecure = config.network.secure || false;
$scope.disableVideo = config.disableVideo || true;
$scope.disableVideo = typeof config.disableVideo === undefined ? true : config.disableVideo;
$scope.unitOpts = [{
name: 'Satoshis (100,000,000 satoshis = 1BTC)',
@ -39,14 +38,14 @@ angular.module('copayApp.controllers').controller('SettingsController',
}
}
$scope.$watch('networkName', function(net) {
$scope.insightHost = net === 'testnet' ? 'test-insight.bitpay.com' : 'insight.bitpay.com';
});
$scope.changeNetwork = function() {
$scope.insightHost = $scope.networkName !== 'testnet' ? 'test-insight.bitpay.com' : 'insight.bitpay.com';
};
$scope.$watch('insightSecure', function(ssl) {
$scope.insightPort = ssl ? 443 : 80;
});
$scope.changeInsightSSL = function() {
$scope.insightPort = $scope.insightSecure ? 80 : 443;
};
$scope.save = function() {

View File

@ -44,8 +44,7 @@ angular.module('copayApp.services')
root.installStartupHandlers = function(wallet, $scope) {
wallet.on('serverError', function(msg) {
notification.error('PeerJS Error', 'There was an error connecting to the PeerJS server.'
+ (msg || 'Check you settings and Internet connection.'));
notification.error('PeerJS Error', 'There was an error connecting to the PeerJS server.' + (msg || 'Check you settings and Internet connection.'));
root.onErrorDigest($scope);
$location.path('addresses');
});