diff --git a/index.html b/index.html index 8a0a5fe4d..980b610fc 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,8 @@
Company Funds
-

4.324 BTC

+

{{totalBalance}} BTC

+

0 BTC

diff --git a/js/config.js b/js/config.js index d73f23cdb..c60630981 100644 --- a/js/config.js +++ b/js/config.js @@ -18,10 +18,12 @@ var config = { verbose: 1, }, blockchain: { - host: 'test.insight.is', - port: 80 - // host: 'localhost', - // port: 3001 + host: 'localhost', + port: 3001 + }, + socket: { + host: 'localhost', + port: 3001 }, verbose: 1, }; diff --git a/js/controllers/header.js b/js/controllers/header.js index 91f00d863..331a51824 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copay.header').controller('HeaderController', - function($scope, $rootScope, $location, walletFactory) { + function($scope, $rootScope, $location, walletFactory, Socket) { $scope.menu = [{ 'title': 'Home', 'icon': 'fi-home', @@ -24,7 +24,7 @@ angular.module('copay.header').controller('HeaderController', 'link': '#/backup' }]; - if (!$rootScope.peerId) { + if (!$rootScope.wallet || !$rootScope.wallet.id) { $location.path('signin'); } @@ -40,6 +40,8 @@ angular.module('copay.header').controller('HeaderController', if (w) { w.disconnect(); delete $rootScope['wallet']; + var socket = Socket($scope); + socket.removeAllListeners(); $location.path('signin'); } }; @@ -47,4 +49,5 @@ angular.module('copay.header').controller('HeaderController', $scope.clearFlashMessage = function() { $rootScope.flashMessage = {}; }; + }); diff --git a/js/controllers/peer.js b/js/controllers/peer.js index f6f482315..f27fc71ce 100644 --- a/js/controllers/peer.js +++ b/js/controllers/peer.js @@ -1,10 +1,31 @@ 'use strict'; angular.module('copay.peer').controller('PeerController', - function($scope, $rootScope, $location, $routeParams) { + function($scope, $rootScope, $location, $routeParams, Socket) { $scope.init = function() { //Network.connect($rootScope.masterId); }; + + var addrs = $rootScope.wallet.getAddressesStr(); + var socket = Socket($scope); + socket.on('connect', function() { + socket.emit('subscribe', 'inv'); + for(var i=0;i