summaryrefslogtreecommitdiffstats
path: root/js/build/app/services/businesslayer/subscriptionsbusinesslayer.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/build/app/services/businesslayer/subscriptionsbusinesslayer.js')
-rw-r--r--js/build/app/services/businesslayer/subscriptionsbusinesslayer.js84
1 files changed, 84 insertions, 0 deletions
diff --git a/js/build/app/services/businesslayer/subscriptionsbusinesslayer.js b/js/build/app/services/businesslayer/subscriptionsbusinesslayer.js
new file mode 100644
index 000000000..45462ed24
--- /dev/null
+++ b/js/build/app/services/businesslayer/subscriptionsbusinesslayer.js
@@ -0,0 +1,84 @@
+// Generated by CoffeeScript 1.6.3
+/*
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt dev@bernhard-posselt.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+(function() {
+ var __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ angular.module('News').factory('SubscriptionsBusinessLayer', [
+ '_BusinessLayer', 'FeedBusinessLayer', 'Persistence', 'ShowAll', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewestItem', function(_BusinessLayer, FeedBusinessLayer, Persistence, ShowAll, ActiveFeed, FeedType, ItemModel, FeedModel, NewestItem) {
+ var SubscriptionsBusinessLayer;
+ SubscriptionsBusinessLayer = (function(_super) {
+ __extends(SubscriptionsBusinessLayer, _super);
+
+ function SubscriptionsBusinessLayer(_feedBusinessLayer, _showAll, feedType, persistence, activeFeed, itemModel, _feedModel, _newestItem) {
+ this._feedBusinessLayer = _feedBusinessLayer;
+ this._showAll = _showAll;
+ this._feedModel = _feedModel;
+ this._newestItem = _newestItem;
+ SubscriptionsBusinessLayer.__super__.constructor.call(this, activeFeed, persistence, itemModel, feedType.Subscriptions);
+ }
+
+ SubscriptionsBusinessLayer.prototype.isVisible = function() {
+ var visible;
+ if (this.isActive(0) && this._feedBusinessLayer.getNumberOfFeeds() > 0) {
+ return true;
+ }
+ if (this._showAll.getShowAll()) {
+ return this._feedBusinessLayer.getNumberOfFeeds() > 0;
+ } else {
+ visible = this._feedBusinessLayer.getNumberOfFeeds() > 0 && this._feedBusinessLayer.getAllUnreadCount() > 0;
+ return visible;
+ }
+ };
+
+ SubscriptionsBusinessLayer.prototype.markRead = function() {
+ var feed, item, newestItemId, _i, _j, _len, _len1, _ref, _ref1;
+ newestItemId = this._newestItem.getId();
+ if (newestItemId !== 0) {
+ _ref = this._feedModel.getAll();
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ feed = _ref[_i];
+ feed.unreadCount = 0;
+ }
+ _ref1 = this._itemModel.getAll();
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+ item = _ref1[_j];
+ item.setRead();
+ }
+ return this._persistence.setAllRead(newestItemId);
+ }
+ };
+
+ SubscriptionsBusinessLayer.prototype.getUnreadCount = function() {
+ return this._feedBusinessLayer.getAllUnreadCount();
+ };
+
+ return SubscriptionsBusinessLayer;
+
+ })(_BusinessLayer);
+ return new SubscriptionsBusinessLayer(FeedBusinessLayer, ShowAll, FeedType, Persistence, ActiveFeed, ItemModel, FeedModel, NewestItem);
+ }
+ ]);
+
+}).call(this);