use of gov.whitehouse.data.model.FeedCategoryConfig in project wh-app-android by WhiteHouse.
the class LiveService method updateEvents.
private void updateEvents() {
final FeedCategoryManager fcm = FeedCategoryManager.get();
final FeedCategoryConfig config = fcm.getFeedCategoryConfig().toBlocking().first();
final List<FeedItem> feedItems;
final List<FeedItem> validItems = new ArrayList<>();
FeedCategoryItem liveItem = null;
for (FeedCategoryItem c : config.feeds()) {
if (FeedCategoryItem.VIEW_TYPE_LIVE.equals(c.viewType())) {
liveItem = c;
break;
}
}
if (liveItem == null) {
return;
}
FeedManager.updateFeedFromServer(liveItem.feedUrl(), liveItem.title(), liveItem.viewType());
feedItems = FeedManager.observeFeedItems(liveItem.feedUrl()).toBlocking().first();
for (FeedItem item : feedItems) {
if (item != null && item.pubDate() != null) {
validItems.add(item);
}
}
sLiveItemCountObservable.onNext(Observable.just(validItems.size()));
mLiveEvents = validItems;
}
Aggregations