diff options
Diffstat (limited to 'js/app/services/businesslayer')
-rw-r--r-- | js/app/services/businesslayer/businesslayer.coffee | 2 | ||||
-rw-r--r-- | js/app/services/businesslayer/feedbusinesslayer.coffee | 10 | ||||
-rw-r--r-- | js/app/services/businesslayer/itembusinesslayer.coffee | 16 |
3 files changed, 15 insertions, 13 deletions
diff --git a/js/app/services/businesslayer/businesslayer.coffee b/js/app/services/businesslayer/businesslayer.coffee index 3096eb71e..622351333 100644 --- a/js/app/services/businesslayer/businesslayer.coffee +++ b/js/app/services/businesslayer/businesslayer.coffee @@ -25,7 +25,7 @@ angular.module('News').factory '_BusinessLayer', -> class BusinessLayer - constructor: (@_activeFeed, @_persistence, @_itemModel, @_type) -> + constructor: (@_activeFeed, @_persistence, @_itemModel, @_type, @_newest) -> load: (id) -> diff --git a/js/app/services/businesslayer/feedbusinesslayer.coffee b/js/app/services/businesslayer/feedbusinesslayer.coffee index 9a23bec43..804b68423 100644 --- a/js/app/services/businesslayer/feedbusinesslayer.coffee +++ b/js/app/services/businesslayer/feedbusinesslayer.coffee @@ -24,15 +24,15 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory 'FeedBusinessLayer', ['_BusinessLayer', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewLoading', '_ExistsError', 'Utils', '$rootScope', -'UndoQueue', +'UndoQueue', 'NewestItem', (_BusinessLayer, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, -FeedModel, NewLoading, _ExistsError, Utils, $rootScope, UndoQueue) -> +FeedModel, NewLoading, _ExistsError, Utils, $rootScope, UndoQueue, NewestItem) -> class FeedBusinessLayer extends _BusinessLayer constructor: (@_showAll, @_feedModel, persistence, activeFeed, feedType, itemModel, @_newLoading, @_utils, @_$rootScope, - @_undoQueue) -> + @_undoQueue, @_newestItem) -> super(activeFeed, persistence, itemModel, feedType.Feed) @_feedType = feedType @@ -70,7 +70,7 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, UndoQueue) -> feed.unreadCount = 0 if @_activeFeed.getId() == feedId and @_activeFeed.getType() == @_feedType.Feed - highestItemId = @_itemModel.getHighestId() + highestItemId = @_newestItem.getId() else highestItemId = 0 @_persistence.setFeedRead(feedId, highestItemId) @@ -198,6 +198,6 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, UndoQueue) -> return new FeedBusinessLayer(ShowAll, FeedModel, Persistence, ActiveFeed, FeedType, ItemModel, NewLoading, Utils, - $rootScope, UndoQueue) + $rootScope, UndoQueue, NewestItem) ]
\ No newline at end of file diff --git a/js/app/services/businesslayer/itembusinesslayer.coffee b/js/app/services/businesslayer/itembusinesslayer.coffee index 99a400385..6d12661ff 100644 --- a/js/app/services/businesslayer/itembusinesslayer.coffee +++ b/js/app/services/businesslayer/itembusinesslayer.coffee @@ -23,14 +23,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory 'ItemBusinessLayer', ['ItemModel', 'FeedModel', 'Persistence', 'ActiveFeed', 'FeedType', -'StarredBusinessLayer', +'StarredBusinessLayer', 'NewestItem', (ItemModel, FeedModel, Persistence, ActiveFeed, FeedType, -StarredBusinessLayer) -> +StarredBusinessLayer, NewestItem) -> class ItemBusinessLayer constructor: (@_itemModel, @_feedModel, @_persistence, @_activeFeed, - @_feedType, @_starredBusinessLayer) -> + @_feedType, @_starredBusinessLayer, @_newestItem) -> getAll: -> return @_itemModel.getAll() @@ -106,10 +106,12 @@ StarredBusinessLayer) -> loadNext: (callback) -> - lowestItemId = @_itemModel.getLowestId() - if lowestItemId != 0 + size = @_itemModel.size() + if size != 0 @_persistence.getItems @_activeFeed.getType(), - @_activeFeed.getId(), lowestItemId, + @_activeFeed.getId(), + size, + @_newestItem.getId(), callback else callback() @@ -121,6 +123,6 @@ StarredBusinessLayer) -> return new ItemBusinessLayer(ItemModel, FeedModel, Persistence, ActiveFeed, - FeedType, StarredBusinessLayer) + FeedType, StarredBusinessLayer, NewestItem) ]
\ No newline at end of file |