add friendly message when the wallet is full

This commit is contained in:
Yemel Jardi 2014-05-19 16:47:28 -07:00
parent 44d62f736f
commit 715a5b2bba
3 changed files with 10 additions and 1 deletions

View File

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

View File

@ -200,8 +200,14 @@ WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphras
self.network.cleanUp();
self.network.start(opts, function() {
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) {
return cb('joinError');
return cb(connectedOnce ? 'walletFull' : 'joinError');
});
self.network.on('data', function(sender, data) {
if (data.type ==='walletId') {

View File

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