fix copayers
This commit is contained in:
parent
5f6c9482b4
commit
475f6ea29e
11 changed files with 62 additions and 32 deletions
|
|
@ -1,18 +1,33 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('CopayersController',
|
||||
function($scope, $rootScope, $location) {
|
||||
function($scope, $rootScope, $timeout, go) {
|
||||
|
||||
console.log('[copayers.js.5]'); //TODO
|
||||
|
||||
$scope.init = function() {
|
||||
var w = $rootScope.wallet;
|
||||
$rootScope.title = 'Waiting copayers for ' + $rootScope.wallet.getName();
|
||||
$scope.loading = false;
|
||||
$scope.secret = $rootScope.wallet.getSecret();
|
||||
|
||||
w.on('publicKeyRingUpdated', $scope.updateList);
|
||||
w.on('ready', $scope.updateList);
|
||||
$scope.updateList();
|
||||
};
|
||||
|
||||
$scope.copayersList = function() {
|
||||
if ($rootScope.wallet) {
|
||||
$scope.copayers = $rootScope.wallet.getRegisteredPeerIds();
|
||||
$scope.updateList = function() {
|
||||
var w = $rootScope.wallet;
|
||||
|
||||
$scope.copayers = $rootScope.wallet.getRegisteredPeerIds();
|
||||
if (w.isComplete()) {
|
||||
|
||||
w.removeListener('publicKeyRingUpdated', $scope.updateList);
|
||||
w.removeListener('ready', $scope.updateList);
|
||||
go.walletHome();
|
||||
}
|
||||
return $scope.copayers;
|
||||
}
|
||||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('HomeWalletController', function($scope, $rootScope, $timeout, $filter, $location, rateService, notification, identityService) {
|
||||
$scope.init = function() {
|
||||
$scope.initHome = function() {
|
||||
var w = $rootScope.wallet;
|
||||
|
||||
$rootScope.title = 'Home';
|
||||
|
||||
|
||||
$scope.rateService = rateService;
|
||||
$scope.isRateAvailable = false;
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
w.on('txProposalEvent', _updateTxs);
|
||||
if (w.isShared())
|
||||
$scope.copayers = w.getRegisteredPeerIds();
|
||||
|
||||
w.on('txProposalEvent', _updateTxs);
|
||||
_updateTxs();
|
||||
|
||||
rateService.whenAvailable(function() {
|
||||
|
|
@ -18,7 +20,9 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
|
|||
});
|
||||
};
|
||||
|
||||
// This is necesarry, since wallet can change in homeWallet, without running init() again.
|
||||
// This is necessary, since wallet can change in homeWallet,
|
||||
// without running init() again.
|
||||
|
||||
var removeWatch;
|
||||
removeWatch = $rootScope.$watch('wallet.id', function(newWallet, oldWallet) {
|
||||
if ($rootScope.wallet && $rootScope.wallet.isComplete() && newWallet !== oldWallet) {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,8 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
|||
var lastAddr = _.first(w.getAddressesOrderer());
|
||||
var balance = w.balanceInfo.balanceByAddr;
|
||||
|
||||
if (balance[lastAddr]>0)
|
||||
$scope.loading = true;
|
||||
|
||||
while (balance && balance[lastAddr] > 0) {
|
||||
$scope.loading = true;
|
||||
$scope.newAddr();
|
||||
lastAddr = w.generateAddress(null);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue