Skip to content

Instantly share code, notes, and snippets.

@kmshack
Created April 12, 2017 15:56
Show Gist options
  • Save kmshack/cb7357a0ad29810c2d9a11d78fb29507 to your computer and use it in GitHub Desktop.
Save kmshack/cb7357a0ad29810c2d9a11d78fb29507 to your computer and use it in GitHub Desktop.
public Observable<Post> loadTodayPosts() {
return mRetrofitService.loadPosts()
.concatMap(new Func1<List<Post>, Observable<Post>>() {
@Override
public Observable<Post> call(List<Post> apiPosts) {
return mDatabaseHelper.savePosts(apiPosts);
}
})
.filter(new Func1<Post, Boolean>() {
@Override
public Boolean call(Post post) {
return isToday(post.date);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment