diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-04 19:58:51 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-04 19:59:06 +0200 |
commit | 346346e01c5c61e61b522520248de90e0ede3f17 (patch) | |
tree | 9d38239274db7e26eac9eda9f1853113e655857b /js/app/services/bl/feedbl.coffee | |
parent | 2d8b635796ba117619063792b0a00c50dc91d2a6 (diff) |
added most of the bl functionality
Diffstat (limited to 'js/app/services/bl/feedbl.coffee')
-rw-r--r-- | js/app/services/bl/feedbl.coffee | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee index ffbc6e51c..d9524ae37 100644 --- a/js/app/services/bl/feedbl.coffee +++ b/js/app/services/bl/feedbl.coffee @@ -21,14 +21,19 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -angular.module('News').factory '_FeedBl', -> +angular.module('News').factory 'FeedBl', +['_Bl', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', +'FeedModel', +(_Bl, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel) -> - class FeedBl + class FeedBl extends _Bl - constructor: (@_feedModel, @_itemBl, @_persistence) -> + constructor: (@_showAll, @_feedModel, persistence, activeFeed, feedType, + itemModel) -> + super(activeFeed, persistence, itemModel, feedType.Feed) - getFeedUnreadCount: (feedId) -> + getUnreadCount: (feedId) -> @_feedModel.getFeedUnreadCount(feedId) @@ -40,7 +45,7 @@ angular.module('News').factory '_FeedBl', -> @_feedModel.getFolderUnreadCount(folderId) - getUnreadCount: -> + getAllUnreadCount: -> return @_feedModel.getUnreadCount() @@ -53,7 +58,10 @@ angular.module('News').factory '_FeedBl', -> feed = @_feedModel.getById(feedId) if angular.isDefined(feed) feed.unreadCount = 0 - @_itemBl.markAllRead(feedId) + highestItemId = @_itemModel.getHighestId() + @_persistence.setFeedRead(feedId, highestItemId) + for item in @_itemModel.getAll() + item.setRead() markAllRead: -> @@ -61,5 +69,13 @@ angular.module('News').factory '_FeedBl', -> @markFeedRead(feed.id) + getNumberOfFeeds: -> + return @_feedModel.size() - return FeedBl + + # todo isvisible, move + + return new FeedBl(ShowAll, FeedModel, Persistence, ActiveFeed, FeedType, + ItemModel) + +]
\ No newline at end of file |