This commit is contained in:
Matias Alejo Garcia 2016-08-24 17:54:01 -03:00
commit 7229adf08a
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
8 changed files with 335 additions and 64 deletions

View file

@ -0,0 +1,47 @@
'use strict';
angular.module('copayApp.controllers').controller('activityController',
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
var self = this;
var setNotifications = function(notifications) {
var n = walletService.processNotifications(notifications);
$scope.notifications = n;
$timeout(function() {
$scope.$apply();
}, 1);
};
$scope.init = function() {
$scope.wallets = profileService.getWallets();
var i = $scope.wallets.length,
j = 0;
// var timeSpan = 60 * 60 * 24 * 7; TODO
var timeSpan = 60 * 60 * 6;
var notifications = [];
$scope.fetchingNotifications = true;
lodash.each($scope.wallets, function(wallet) {
walletService.getNotifications(wallet, {
timeSpan: timeSpan
}, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
notifications.push(n);
if (++j == i) {
$scope.fetchingNotifications = false;
setNotifications(lodash.compact(lodash.flatten(notifications)));
};
});
});
}
});