diff options
Diffstat (limited to 'js/app')
-rw-r--r-- | js/app/services/bl/feedbl.coffee | 30 | ||||
-rw-r--r-- | js/app/services/persistence.coffee | 12 |
2 files changed, 27 insertions, 15 deletions
diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee index 088f2e623..77b3d81e2 100644 --- a/js/app/services/bl/feedbl.coffee +++ b/js/app/services/bl/feedbl.coffee @@ -23,13 +23,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory 'FeedBl', ['_Bl', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', -'FeedModel', -(_Bl, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel) -> +'FeedModel', 'NewLoading', +(_Bl, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel, +NewLoading) -> class FeedBl extends _Bl constructor: (@_showAll, @_feedModel, persistence, activeFeed, feedType, - itemModel) -> + itemModel, @_newLoading) -> super(activeFeed, persistence, itemModel, feedType.Feed) @@ -92,15 +93,22 @@ angular.module('News').factory 'FeedBl', setShowAll: (showAll) -> @_showAll.setShowAll(showAll) - @_persistence.getItems( - @_activeFeed.getType(), - @_activeFeed.getId(), - 0 - ) + + # TODO: this callback is not tested with a unittest + callback = => + @_itemModel.clear() + @_newLoading.increase() + @_persistence.getItems( + @_activeFeed.getType(), + @_activeFeed.getId(), + 0, + => + @_newLoading.decrease() + ) if showAll - @_persistence.userSettingsReadShow() + @_persistence.userSettingsReadShow(callback) else - @_persistence.userSettingsReadHide() + @_persistence.userSettingsReadHide(callback) isShowAll: -> @@ -112,6 +120,6 @@ angular.module('News').factory 'FeedBl', return new FeedBl(ShowAll, FeedModel, Persistence, ActiveFeed, FeedType, - ItemModel) + ItemModel, NewLoading) ]
\ No newline at end of file diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee index 2231a5b79..7d0ecd5a0 100644 --- a/js/app/services/persistence.coffee +++ b/js/app/services/persistence.coffee @@ -302,18 +302,22 @@ angular.module('News').factory '_Persistence', -> @_request.get 'news_usersettings_read', params - userSettingsReadShow: -> + userSettingsReadShow: (callback) -> ### Sets the reader mode to show all ### - @_request.post 'news_usersettings_read_show' + data = + onSuccess: callback + @_request.post 'news_usersettings_read_show', data - userSettingsReadHide: -> + userSettingsReadHide: (callback) -> ### Sets the reader mode to show only unread ### - @_request.post 'news_usersettings_read_hide' + data = + onSuccess: callback + @_request.post 'news_usersettings_read_hide', data _triggerHideRead: -> |