mirror of https://github.com/BTCPrivate/copay.git
fix copayers
This commit is contained in:
parent
5f6c9482b4
commit
475f6ea29e
|
@ -1,18 +1,33 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('CopayersController',
|
angular.module('copayApp.controllers').controller('CopayersController',
|
||||||
function($scope, $rootScope, $location) {
|
function($scope, $rootScope, $timeout, go) {
|
||||||
|
|
||||||
|
console.log('[copayers.js.5]'); //TODO
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
|
var w = $rootScope.wallet;
|
||||||
$rootScope.title = 'Waiting copayers for ' + $rootScope.wallet.getName();
|
$rootScope.title = 'Waiting copayers for ' + $rootScope.wallet.getName();
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.secret = $rootScope.wallet.getSecret();
|
$scope.secret = $rootScope.wallet.getSecret();
|
||||||
|
|
||||||
|
w.on('publicKeyRingUpdated', $scope.updateList);
|
||||||
|
w.on('ready', $scope.updateList);
|
||||||
|
$scope.updateList();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.copayersList = function() {
|
$scope.updateList = function() {
|
||||||
if ($rootScope.wallet) {
|
var w = $rootScope.wallet;
|
||||||
|
|
||||||
$scope.copayers = $rootScope.wallet.getRegisteredPeerIds();
|
$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,14 +1,16 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('HomeWalletController', function($scope, $rootScope, $timeout, $filter, $location, rateService, notification, identityService) {
|
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';
|
$rootScope.title = 'Home';
|
||||||
|
|
||||||
|
|
||||||
$scope.rateService = rateService;
|
$scope.rateService = rateService;
|
||||||
$scope.isRateAvailable = false;
|
$scope.isRateAvailable = false;
|
||||||
|
|
||||||
var w = $rootScope.wallet;
|
if (w.isShared())
|
||||||
|
$scope.copayers = w.getRegisteredPeerIds();
|
||||||
|
|
||||||
w.on('txProposalEvent', _updateTxs);
|
w.on('txProposalEvent', _updateTxs);
|
||||||
_updateTxs();
|
_updateTxs();
|
||||||
|
|
||||||
|
@ -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;
|
var removeWatch;
|
||||||
removeWatch = $rootScope.$watch('wallet.id', function(newWallet, oldWallet) {
|
removeWatch = $rootScope.$watch('wallet.id', function(newWallet, oldWallet) {
|
||||||
if ($rootScope.wallet && $rootScope.wallet.isComplete() && 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 lastAddr = _.first(w.getAddressesOrderer());
|
||||||
var balance = w.balanceInfo.balanceByAddr;
|
var balance = w.balanceInfo.balanceByAddr;
|
||||||
|
|
||||||
if (balance[lastAddr]>0)
|
|
||||||
$scope.loading = true;
|
|
||||||
|
|
||||||
while (balance && balance[lastAddr] > 0) {
|
while (balance && balance[lastAddr] > 0) {
|
||||||
|
$scope.loading = true;
|
||||||
$scope.newAddr();
|
$scope.newAddr();
|
||||||
lastAddr = w.generateAddress(null);
|
lastAddr = w.generateAddress(null);
|
||||||
};
|
};
|
||||||
|
|
|
@ -509,6 +509,9 @@ Identity.prototype.bindWallet = function(w) {
|
||||||
w.on('publicKeyRingUpdated', function() {
|
w.on('publicKeyRingUpdated', function() {
|
||||||
Identity.storeWalletDebounced(self, w);
|
Identity.storeWalletDebounced(self, w);
|
||||||
});
|
});
|
||||||
|
w.on('ready', function() {
|
||||||
|
Identity.storeWalletDebounced(self, w);
|
||||||
|
});
|
||||||
|
|
||||||
this.emitAndKeepAlive('newWallet', w.getId());
|
this.emitAndKeepAlive('newWallet', w.getId());
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,6 +127,7 @@ angular
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
||||||
|
|
||||||
if (!ls || ls.length < 1) {
|
if (!ls || ls.length < 1) {
|
||||||
$location.path('unsupported');
|
$location.path('unsupported');
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,7 +135,8 @@ angular
|
||||||
$idle.unwatch();
|
$idle.unwatch();
|
||||||
$location.path('/');
|
$location.path('/');
|
||||||
}
|
}
|
||||||
if ($rootScope.wallet && !$rootScope.wallet.isComplete() && next.walletShouldBeComplete) {
|
if ($rootScope.wallet && !$rootScope.wallet.isComplete()
|
||||||
|
&& next.walletShouldBeComplete) {
|
||||||
$location.path('/copayers');
|
$location.path('/copayers');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,24 +57,23 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
|
||||||
};
|
};
|
||||||
|
|
||||||
root.walletHome = function() {
|
root.walletHome = function() {
|
||||||
console.log('[go.js.25:walletHome:]'); //TODO
|
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
preconditions.checkState(w);
|
preconditions.checkState(w);
|
||||||
$rootScope.starting = false;
|
$rootScope.starting = false;
|
||||||
|
|
||||||
if (!w.isComplete()) {
|
if (!w.isComplete()) {
|
||||||
root.path('copayers');
|
root.path('copayers');
|
||||||
} else {
|
} else {
|
||||||
if ($rootScope.pendingPayment) {
|
if ($rootScope.pendingPayment) {
|
||||||
root.path('selectWalletForPayment');
|
root.path('selectWalletForPayment');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
console.log('[go.js.36]'); //TODO
|
|
||||||
root.path('homeWallet');
|
root.path('homeWallet');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
root.home = function() {
|
root.home = function() {
|
||||||
|
console.log('[go.js.48:home:]'); //TODO
|
||||||
if ($rootScope.iden)
|
if ($rootScope.iden)
|
||||||
root.walletHome();
|
root.walletHome();
|
||||||
else
|
else
|
||||||
|
@ -83,6 +82,8 @@ console.log('[go.js.36]'); //TODO
|
||||||
|
|
||||||
|
|
||||||
root.send = function() {
|
root.send = function() {
|
||||||
|
|
||||||
|
console.log('[go.js.58]'); //TODO
|
||||||
$location.path('send');
|
$location.path('send');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ var inherits = function(ctor, superCtor) {
|
||||||
|
|
||||||
inherits(FakeSocket, EventEmitter);
|
inherits(FakeSocket, EventEmitter);
|
||||||
|
|
||||||
FakeSocket.prototype.removeEventListener = function() {
|
FakeSocket.prototype.removeListener = function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div ng-controller="CopayersController">
|
<div ng-controller="CopayersController" ng-init="init()">
|
||||||
<div class="row hide-for-large-up">
|
<div class="row hide-for-large-up">
|
||||||
<div class="medium-12 small-12 columns">
|
<div class="medium-12 small-12 columns">
|
||||||
<h1 translate>
|
<h1 translate>
|
||||||
|
@ -12,6 +12,13 @@
|
||||||
<div class="panel oh">
|
<div class="panel oh">
|
||||||
<h2 class="line-b">
|
<h2 class="line-b">
|
||||||
Share this secret with your other copayers
|
Share this secret with your other copayers
|
||||||
|
<div class="right size-10">
|
||||||
|
<span ng-if="!$root.wallet.isShared()">Personal Wallet</span>
|
||||||
|
<span ng-if="$root.wallet.isShared()">
|
||||||
|
Multisignature wallet [{{$root.wallet.requiredCopayers}} of {{$root.wallet.totalCopayers}} ]
|
||||||
|
</span>
|
||||||
|
<span ng-if="$root.wallet.isTestnet()"> in TESTNET</span>
|
||||||
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<qrcode size="250" data="{{secret}}"></qrcode>
|
<qrcode size="250" data="{{secret}}"></qrcode>
|
||||||
|
@ -22,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel oh">
|
<div class="panel oh">
|
||||||
<div ng-include="'views/includes/copayer.html'"></div>
|
<div ng-include="'views/includes/copayers.html'"></div>
|
||||||
<div class="copay-box" ng-if="!$root.wallet.isComplete()">
|
<div class="copay-box" ng-if="!$root.wallet.isComplete()">
|
||||||
<span ng-include="'views/includes/photo.html'"></span>
|
<span ng-include="'views/includes/photo.html'"></span>
|
||||||
<p class="size-12 text-white text-light m0">
|
<p class="size-12 text-white text-light m0">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="home-wallet" ng-controller="HomeWalletController" ng-init="init()">
|
<div class="home-wallet" ng-controller="HomeWalletController" ng-init="initHome()">
|
||||||
<div class="row hide-for-large-up">
|
<div class="row hide-for-large-up">
|
||||||
<div class="medium-12 small-12 columns">
|
<div class="medium-12 small-12 columns">
|
||||||
<h1 translate>Home</h1>
|
<h1 translate>Home</h1>
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<div class="panel oh">
|
<div class="panel oh">
|
||||||
<h2 class="line-b" translate>Copayers</h2>
|
<h2 class="line-b" translate>Copayers</h2>
|
||||||
<div ng-include="'views/includes/copayer.html'"></div>
|
<div ng-include="'views/includes/copayers.html'"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div ng-controller="CopayersController">
|
<div>
|
||||||
<div class="copay-box" ng-repeat="copayer in copayersList()">
|
<div class="copay-box" ng-repeat="copayer in copayers">
|
||||||
<div class="photo-container">
|
<div class="photo-container">
|
||||||
<img gravatar-src="'{{copayer.nick}}'" gravatar-size="35">
|
<img gravatar-src="'{{copayer.nick}}'" gravatar-size="35">
|
||||||
</div>
|
</div>
|
|
@ -2,7 +2,7 @@
|
||||||
<h1>
|
<h1>
|
||||||
{{$root.title}}
|
{{$root.title}}
|
||||||
<small ng-if="$root.wallet">
|
<small ng-if="$root.wallet">
|
||||||
<a class="text-gray" ng-click="refresh()" ng-if="!$root.updatingBalance">
|
<a class="text-gray" ng-click="refresh()" ng-if="$root.wallet.isComplete() && !$root.updatingBalance">
|
||||||
<i class="fi-refresh"></i>
|
<i class="fi-refresh"></i>
|
||||||
</a>
|
</a>
|
||||||
<span ng-if="$root.updatingBalance">
|
<span ng-if="$root.updatingBalance">
|
||||||
|
|
Loading…
Reference in New Issue