Trying to fix bip72

This commit is contained in:
Gustavo Maximiliano Cortez 2014-12-01 05:24:19 -03:00
commit 92737bc49c
8 changed files with 50 additions and 43 deletions

View file

@ -2,27 +2,12 @@
angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $modal, $location, balanceService) {
$scope.wallets = [];
$rootScope.title = 'Payment intent';
$scope.wallets = $rootScope.iden.listWallets();
$rootScope.title = 'Payment intent';
var l = $scope.wallet.length;
_.each($scope.wallets, function(w, i) {
balanceService.update(w, function(){
if (i === l-1)
$rootScope.$digest();
});
});
$scope.open = function() {
$scope.open = function() {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
items: function() {
return $scope.wallets;
}
}
controller: ModalInstanceCtrl
});
};
@ -30,8 +15,22 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
var ModalInstanceCtrl = function($scope, $modalInstance, items, identityService) {
$scope.wallets = items;
var ModalInstanceCtrl = function($scope, $modalInstance, identityService) {
$scope.loading = true;
$scope.setWallets = function() {
if (!$rootScope.iden) return;
var ret = _.filter($rootScope.iden.listWallets(), function(w) {
return w.balanceInfo && w.balanceInfo.totalBalanceBTC;
});
$scope.wallets = ret;
$scope.loading = false;
};
if ($rootScope.iden) {
var iden = $rootScope.iden;
iden.on('newWallet', function() {
$scope.setWallets();
});
}
$scope.ok = function(selectedItem) {
identityService.setPaymentWallet(selectedItem);
$modalInstance.close();