Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
interface PostRepository {
fun fetchFeeds(): Completable
fun getFeeds(): Observable<List<Post>>
class PostRepositoryImpl : PostRepository {
private val remoteDataSource: PostApiService by inject()
private val localDataSource: PostDao by inject()
override fun fetchFeeds(): Completable {
return remoteDataSource.fetchFeeds()
.flatMapObservable {
if (it.isSuccessful)
throw HttpException(it)
}.concatMapCompletable {
Completable.fromAction {
override fun getFeeds(): Observable<List<Post>> {
return localDataSource.getPostList()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.