Commit 6634361d authored by Vladislav's avatar Vladislav

provide article id via injection

parent 5d14095e
......@@ -8,8 +8,10 @@ import dagger.Binds
import dagger.BindsInstance
import dagger.Component
import dagger.Module
import javax.inject.Named
const val ARTICLE_SCREEN_ARTICLEID="ARTICLE_SCREEN_ARTICLEID_KEY"
@PerScreen
@Component(
modules = [ArticleScreenModule::class],
......@@ -21,6 +23,7 @@ interface ArticleScreenComponent {
fun create(
appComponent: AppComponent
,@BindsInstance activity: RoomParkMainActivity
,@BindsInstance @Named(ARTICLE_SCREEN_ARTICLEID) articleId:Int
): ArticleScreenComponent
}
......
......@@ -7,6 +7,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Named
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
......@@ -14,7 +15,8 @@ import javax.inject.Inject
class ArticleScreenPresenter @Inject constructor(
private val interactor: ArticleInteractor
private val interactor: ArticleInteractor,
@Named(ARTICLE_SCREEN_ARTICLEID) private val selectedArticleId:Int
)
: BigantoBasePresenter<ArticleScreen, ArticleScreenViewState>() {
override fun defaultErrorViewStateHandler()=
......@@ -23,7 +25,7 @@ class ArticleScreenPresenter @Inject constructor(
override fun bindIntents() {
val prefetchCards = interactor.fetchArticles(2)
val prefetchCards = interactor.fetchArticles(selectedArticleId)
.map { ArticleScreenViewState.ArticleLoaded(it) }
val state = restoreStateObservable
......
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