fix wallet updates
This commit is contained in:
parent
fbede5a903
commit
b2508b7195
8 changed files with 60 additions and 79 deletions
|
|
@ -6,8 +6,7 @@ angular.module('copay.backup').controller('BackupController',
|
|||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
}
|
||||
|
||||
$scope.title = 'Backup';
|
||||
|
|
|
|||
|
|
@ -3,40 +3,34 @@
|
|||
angular.module('copay.home').controller('HomeController',
|
||||
function($scope, $rootScope, $location, Socket, controllerUtils) {
|
||||
$scope.title = 'Home';
|
||||
|
||||
$scope.oneAtATime = true;
|
||||
$scope.addrBalance = {};
|
||||
|
||||
var _getBalance = function() {
|
||||
$scope.addrs.forEach(function(addr) {
|
||||
$rootScope.wallet.getBalance([addr], function(balance) {
|
||||
$scope.addrBalance[addr] = balance;
|
||||
$scope.$digest();
|
||||
});
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
|
||||
var _updateBalance = function () {
|
||||
w.getBalance(function (balance, balanceByAddr) {
|
||||
$scope.balanceByAddr = balanceByAddr;
|
||||
$scope.addrs = Object.keys(balanceByAddr);
|
||||
$scope.selectedAddr = $scope.addrs[0];
|
||||
$scope.$digest();
|
||||
});
|
||||
var socket = Socket($scope);
|
||||
controllerUtils.handleTransactionByAddress($scope, _updateBalance);
|
||||
};
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
} else {
|
||||
$scope.addrs = $rootScope.wallet.getAddressesStr(true);
|
||||
$scope.selectedAddr = $scope.addrs[0];
|
||||
|
||||
_getBalance();
|
||||
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
}
|
||||
|
||||
$scope.newAddr = function() {
|
||||
var a = $rootScope.wallet.generateAddress().toString();
|
||||
$scope.addrs.push(a);
|
||||
_getBalance();
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
var a = w.generateAddress().toString();
|
||||
_updateBalance();
|
||||
};
|
||||
|
||||
$scope.selectAddr = function(addr) {
|
||||
$scope.selectedAddr = addr;
|
||||
};
|
||||
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
_updateBalance();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ angular.module('copay.peer').controller('PeerController',
|
|||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@ angular.module('copay.send').controller('SendController',
|
|||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
}
|
||||
|
||||
$scope.sendTest = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue