Merge branch 'master' into feature/01-alert-txs

This commit is contained in:
Gustavo Cortez 2014-05-20 14:45:32 -03:00
commit 3f8612ee0c
7 changed files with 22 additions and 13 deletions

View File

@ -110,7 +110,7 @@ body {
background: #fff; background: #fff;
} }
.addresses .panel:hover { .addresses .panel:hover, .addresses .panel.selected {
background: #efefef; background: #efefef;
} }

View File

@ -314,13 +314,12 @@
<!-- ADDRESS --> <!-- ADDRESS -->
<script type="text/ng-template" id="addresses.html"> <script type="text/ng-template" id="addresses.html">
<div class="addresses" data-ng-controller="AddressesController"> <div class="addresses" ng-controller="AddressesController">
<div ng-show='$root.wallet.publicKeyRing.isComplete()'> <div ng-show='$root.wallet.publicKeyRing.isComplete()'>
<div class="row"> <div class="row">
<div class="large-9 medium-12 columns" ng-if="addrInfos[0]"> <div class="large-9 medium-12 columns" ng-if="addrInfos[0]">
<div class="large-8 medium-8 columns"> <div class="large-8 medium-8 columns">
<a class="panel radius db" ng-repeat="addrInfo in addrInfos" <a class="panel radius db" ng-repeat="addrInfo in addrInfos" ng-click="$root.selectedAddr = addrInfo.address.toString()" ng-class="selectAddr('{{addrInfo.address.toString()}}')">
ng-click="selectAddr(addrInfo.address.toString())">
<span>{{addrInfo.address.toString()}}</span> <span>{{addrInfo.address.toString()}}</span>
<span ng-if="addrInfo.isChange">(change)</span> <span ng-if="addrInfo.isChange">(change)</span>
<span class="right"> <span class="right">

View File

@ -1,23 +1,24 @@
'use strict'; 'use strict';
angular.module('copay.addresses').controller('AddressesController', angular.module('copay.addresses').controller('AddressesController',
function($scope, $rootScope, controllerUtils) { function($scope, $rootScope, $timeout, controllerUtils) {
$scope.loading = false; $scope.loading = false;
var w = $rootScope.wallet; var w = $rootScope.wallet;
$scope.newAddr = function() { $scope.newAddr = function() {
$scope.loading=true; $scope.loading = true;
w.generateAddress(null, function() { w.generateAddress(null, function() {
setTimeout(function() { $timeout(function() {
controllerUtils.setSocketHandlers(); controllerUtils.setSocketHandlers();
controllerUtils.updateAddressList(); controllerUtils.updateAddressList();
$scope.loading=false; $rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString();
$scope.loading = false;
$rootScope.$digest(); $rootScope.$digest();
},1); },1);
}); });
}; };
$scope.selectAddr = function(addr) { $scope.selectAddr = function (addr) {
$scope.selectedAddr = addr; return addr === $rootScope.selectedAddr ? 'selected' : '';
}; };
}); });

View File

@ -67,6 +67,8 @@ angular.module('copay.signin').controller('SigninController',
if (err || !w) { if (err || !w) {
if (err === 'joinError') if (err === 'joinError')
$rootScope.flashMessage = { message: 'Can not find peer'}; $rootScope.flashMessage = { message: 'Can not find peer'};
else if (err === 'walletFull')
$rootScope.flashMessage = { message: 'The wallet is full'};
else if (err === 'badSecret') else if (err === 'badSecret')
$rootScope.flashMessage = { message: 'Bad secret secret string', type: 'error'}; $rootScope.flashMessage = { message: 'Bad secret secret string', type: 'error'};
else else

View File

@ -200,8 +200,14 @@ WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphras
self.network.cleanUp(); self.network.cleanUp();
self.network.start(opts, function() { self.network.start(opts, function() {
self.network.connectTo(s.pubKey); self.network.connectTo(s.pubKey);
// This is a hack to reconize if the connection was rejected or the peer wasn't there.
var connectedOnce = false;
self.network.on('connected', function(sender, data) {
connectedOnce = true;
});
self.network.on('onlyYou', function(sender, data) { self.network.on('onlyYou', function(sender, data) {
return cb('joinError'); return cb(connectedOnce ? 'walletFull' : 'joinError');
}); });
self.network.on('data', function(sender, data) { self.network.on('data', function(sender, data) {
if (data.type ==='walletId') { if (data.type ==='walletId') {

View File

@ -223,6 +223,7 @@ Network.prototype._setupConnectionHandlers = function(dataConn, toCopayerId) {
// The connecting peer send hello // The connecting peer send hello
if(toCopayerId) { if(toCopayerId) {
self.emit('connected');
self._sendHello(toCopayerId); self._sendHello(toCopayerId);
self._addConnectedCopayer(toCopayerId); self._addConnectedCopayer(toCopayerId);
} }

View File

@ -19,7 +19,7 @@ angular.module('copay.controllerUtils')
video.close(); video.close();
// Clear rootScope // Clear rootScope
for (var i in $rootScope) { for (var i in $rootScope) {
if (i.charAt(0) != '$') { if (i.charAt(0) != '$' && i != 'flashMessage') {
delete $rootScope[i]; delete $rootScope[i];
} }
} }