mirror of https://github.com/BTCPrivate/copay.git
Alert for transaction support in navbar (red label).
Fixes Sign and Reject Transactions. Known bugs: * After 5 continuous transactions, connection is lost with peers * 1-of-1 wallet does not refresh automatically
This commit is contained in:
parent
cb00a5b629
commit
8a03225cd2
|
@ -55,8 +55,8 @@
|
|||
<section class="top-bar-section {{isCollapsed && 'hide_menu' || 'show_menu'}}">
|
||||
<ul>
|
||||
<li data-ng-repeat="item in menu" ui-route="/{{item.link}}" class="text-center" data-ng-class="{active: isActive(item)}">
|
||||
<a href="{{item.link}}"> <i class="{{item.icon}}"></i> {{item.title}}
|
||||
<span ng-if="item.title=='Transactions'">({{$root.txslength}})</span>
|
||||
<a href="{{item.link}}"> <i class="{{item.icon}}"></i> {{item.title}}
|
||||
<span class="label alert round" ng-if="item.title=='Transactions' && $root.txslength > 0">{{$root.txslength}}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -16,6 +16,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
: {type:'error', message: 'There was an error sending the Transaction'}
|
||||
;
|
||||
controllerUtils.updateTxs();
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
});
|
||||
};
|
||||
|
@ -28,15 +29,18 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
if (!ret) {
|
||||
$rootScope.flashMessage = {type:'error', message: 'There was an error signing the Transaction'};
|
||||
controllerUtils.updateTxs();
|
||||
$rootScope.$digest();
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
return;
|
||||
}
|
||||
var p = w.txProposals.getTxProposal(ntxid);
|
||||
if (p.builder.isFullySigned()) {
|
||||
$scope.send(ntxid);
|
||||
controllerUtils.updateTxs();
|
||||
}
|
||||
else {
|
||||
controllerUtils.updateTxs();
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
}
|
||||
};
|
||||
|
@ -64,8 +68,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
var w = $rootScope.wallet;
|
||||
w.reject(ntxid);
|
||||
$rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'};
|
||||
controllerUtils.updateTxs();
|
||||
// $rootScope.$digest();
|
||||
$scope.loading = false;
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -346,7 +346,7 @@ Wallet.prototype.reject = function(ntxid) {
|
|||
txp.rejectedBy[myId] = Date.now();
|
||||
this.sendTxProposals();
|
||||
this.store();
|
||||
this.emit('refresh');
|
||||
this.emit('txProposalsUpdated');
|
||||
};
|
||||
|
||||
|
||||
|
@ -367,7 +367,7 @@ Wallet.prototype.sign = function(ntxid) {
|
|||
txp.signedBy[myId] = Date.now();
|
||||
this.sendTxProposals();
|
||||
this.store();
|
||||
this.emit('refresh');
|
||||
this.emit('txProposalsUpdated');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -85,6 +85,7 @@ angular.module('copay.controllerUtils')
|
|||
w.on('txProposalsUpdated', function() {
|
||||
console.log('[ txProposalsUpdated ]'); //TODO
|
||||
root.updateTxs();
|
||||
root.updateBalance();
|
||||
});
|
||||
w.on('openError', root.onErrorDigest);
|
||||
w.on('connect', function(peerID) {
|
||||
|
@ -153,8 +154,13 @@ angular.module('copay.controllerUtils')
|
|||
txs.push(i);
|
||||
});
|
||||
$rootScope.txs = txs;
|
||||
console.log('[controllerUtils.js:155]',txs); //TODO
|
||||
$rootScope.txslength = txs.length;
|
||||
var txps = 0;
|
||||
for(var i=0; i<txs.length;i++) {
|
||||
if (!txs[i].finallyRejected && !txs[i].sentTs) {
|
||||
txps++;
|
||||
}
|
||||
}
|
||||
$rootScope.txslength = txps;
|
||||
w.removeListener('txProposalsUpdated',root.updateTxs)
|
||||
w.once('txProposalsUpdated',root.updateTxs);
|
||||
$rootScope.loading = false;
|
||||
|
|
Loading…
Reference in New Issue