Commit 6634361d authored by Vladislav's avatar Vladislav

provide article id via injection

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