Commit 9e7809d1 authored by Vladislav's avatar Vladislav

set flag on startup article screen

parent 5fb56b38
...@@ -17,6 +17,8 @@ class ArticleInteractor @Inject constructor( ...@@ -17,6 +17,8 @@ class ArticleInteractor @Inject constructor(
fun fetchArticle(articleId: Int): Observable<ArticleModel> = fun fetchArticle(articleId: Int): Observable<ArticleModel> =
uc.getArticle(articleId) uc.getArticle(articleId)
fun setArticleRead(articleId: Int) = uc.setRead(articleId)
// Single.just( // Single.just(
// when (articleId) { // when (articleId) {
// 2 -> article2 // 2 -> article2
......
...@@ -28,8 +28,14 @@ class ArticleScreenPresenter @Inject constructor( ...@@ -28,8 +28,14 @@ class ArticleScreenPresenter @Inject constructor(
val prefetchCards = interactor.fetchArticle(selectedArticleId) val prefetchCards = interactor.fetchArticle(selectedArticleId)
.map { ArticleScreenViewState.ArticleLoaded(it) } .map { ArticleScreenViewState.ArticleLoaded(it) }
val setRead = interactor.setArticleRead(selectedArticleId)
.andThen({ ArticleScreenViewState.Idle()})
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(prefetchCards) .mergeWith(prefetchCards)
.mergeWith(setRead)
.doOnError{ Timber.e(it)} .doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment