mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #77 from JDonadio/fix/notifications
Fix notifications shown
This commit is contained in:
commit
413c1fc8a3
|
@ -19,7 +19,7 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="list card">
|
<div class="list card" ng-if="notifications[0]">
|
||||||
<a class="item item-icon-right item-heading" ui-sref="tabs.activity" translate>
|
<a class="item item-icon-right item-heading" ui-sref="tabs.activity" translate>
|
||||||
Recent Activity
|
Recent Activity
|
||||||
<i class="icon nav-item-arrow-right"></i>
|
<i class="icon nav-item-arrow-right"></i>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<ion-spinner icon="lines"></ion-spinner>
|
<ion-spinner icon="lines"></ion-spinner>
|
||||||
<div translate>Updating activity. Please stand by</div>
|
<div translate>Updating activity. Please stand by</div>
|
||||||
</span>
|
</span>
|
||||||
<a ng-if="notifications[0]" class="item" ng-repeat="x in notifications" ng-click="x.action()">
|
<a class="item" ng-repeat="x in notifications" ng-click="x.action()">
|
||||||
<span ng-include="'views/includes/walletActivity.html'"></span>
|
<span ng-include="'views/includes/walletActivity.html'"></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,7 +30,7 @@ angular.module('copayApp.services')
|
||||||
|
|
||||||
root.updateWalletSettings = function(wallet) {
|
root.updateWalletSettings = function(wallet) {
|
||||||
var defaults = configService.getDefaults();
|
var defaults = configService.getDefaults();
|
||||||
configService.whenAvailable(function(config){
|
configService.whenAvailable(function(config) {
|
||||||
wallet.usingCustomBWS = config.bwsFor && config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url);
|
wallet.usingCustomBWS = config.bwsFor && config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url);
|
||||||
wallet.name = (config.aliasFor && config.aliasFor[wallet.id]) || wallet.credentials.walletName;
|
wallet.name = (config.aliasFor && config.aliasFor[wallet.id]) || wallet.credentials.walletName;
|
||||||
wallet.color = (config.colorFor && config.colorFor[wallet.id]) || '#4A90E2';
|
wallet.color = (config.colorFor && config.colorFor[wallet.id]) || '#4A90E2';
|
||||||
|
@ -762,7 +762,7 @@ angular.module('copayApp.services')
|
||||||
var TIME_STAMP = 60 * 60 * 24 * 7;
|
var TIME_STAMP = 60 * 60 * 24 * 7;
|
||||||
var MAX = 100;
|
var MAX = 100;
|
||||||
|
|
||||||
var ignored = {
|
var typeFilter1 = {
|
||||||
'NewBlock': 1,
|
'NewBlock': 1,
|
||||||
'BalanceUpdated': 1,
|
'BalanceUpdated': 1,
|
||||||
'NewOutgoingTxByThirdParty': 1,
|
'NewOutgoingTxByThirdParty': 1,
|
||||||
|
@ -771,6 +771,12 @@ angular.module('copayApp.services')
|
||||||
'TxProposalFinallyRejected': 1,
|
'TxProposalFinallyRejected': 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var typeFilter2 = {
|
||||||
|
'TxProposalAcceptedBy': 1,
|
||||||
|
'TxProposalRejectedBy': 1,
|
||||||
|
'NewTxProposal': 1,
|
||||||
|
}
|
||||||
|
|
||||||
var w = root.getWallets();
|
var w = root.getWallets();
|
||||||
if (lodash.isEmpty(w)) return cb();
|
if (lodash.isEmpty(w)) return cb();
|
||||||
|
|
||||||
|
@ -868,9 +874,15 @@ angular.module('copayApp.services')
|
||||||
$log.warn('Error updating notifications:' + err);
|
$log.warn('Error updating notifications:' + err);
|
||||||
} else {
|
} else {
|
||||||
var n = lodash.filter(wallet.cachedActivity.n, function(x) {
|
var n = lodash.filter(wallet.cachedActivity.n, function(x) {
|
||||||
return !ignored[x.type];
|
return !typeFilter1[x.type];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (wallet.n == 1) {
|
||||||
|
var n = lodash.filter(n, function(x) {
|
||||||
|
return !typeFilter2[x.type];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var idToName = {};
|
var idToName = {};
|
||||||
if (wallet.cachedStatus) {
|
if (wallet.cachedStatus) {
|
||||||
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {
|
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {
|
||||||
|
@ -911,7 +923,7 @@ angular.module('copayApp.services')
|
||||||
txps = txps.concat(x.pendingTxps);
|
txps = txps.concat(x.pendingTxps);
|
||||||
});
|
});
|
||||||
txps = lodash.sortBy(txps, 'pendingForUs', 'createdOn');
|
txps = lodash.sortBy(txps, 'pendingForUs', 'createdOn');
|
||||||
txps = lodash.compact(lodash.flatten(txps)).slice(0,MAX);
|
txps = lodash.compact(lodash.flatten(txps)).slice(0, MAX);
|
||||||
var n = txps.length;
|
var n = txps.length;
|
||||||
return cb(null, txps, n);
|
return cb(null, txps, n);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue