Commit 3f7f30b5 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

minor fixes

parent a4a7079b
...@@ -4,6 +4,7 @@ import com.biganto.visual.roompark.conductor.BigantoBasePresenter ...@@ -4,6 +4,7 @@ import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.DealsInteractor import com.biganto.visual.roompark.domain.interactor.DealsInteractor
import com.biganto.visual.roompark.domain.model.DealPreviewModel import com.biganto.visual.roompark.domain.model.DealPreviewModel
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import timber.log.Timber import timber.log.Timber
...@@ -20,7 +21,7 @@ class DealsScreenPresenter @Inject constructor( ...@@ -20,7 +21,7 @@ class DealsScreenPresenter @Inject constructor(
: BigantoBasePresenter<DealsScreen, DealsScreenViewState>() { : BigantoBasePresenter<DealsScreen, DealsScreenViewState>() {
override fun defaultErrorViewStateHandler() = override fun defaultErrorViewStateHandler() =
{e:ExceptionString -> DealsScreenViewState.SomeError(e)} { e: ExceptionString -> DealsScreenViewState.SomeError(e) }
override fun bindIntents() { override fun bindIntents() {
...@@ -29,22 +30,27 @@ class DealsScreenPresenter @Inject constructor( ...@@ -29,22 +30,27 @@ class DealsScreenPresenter @Inject constructor(
val fetchDeals = interactor.fetchDeals() val fetchDeals = interactor.fetchDeals()
.flatMap { deals -> .flatMap { deals ->
getStatusList getStatusList
.map { List(deals.size) { index -> .map {
List(deals.size) { index ->
DealPreviewModel( DealPreviewModel(
Pair(deals[index], it) Pair(deals[index], it)
) )
} } }
}
} }
.map(DealsScreenViewState::DealsLoaded) .map(DealsScreenViewState::DealsLoaded)
val state = restoreStateObservable val state = Observable.mergeDelayError(
.mergeWith(fetchDeals) arrayListOf(
.doOnError{ Timber.e(it)} restoreStateObservable,
fetchDeals
)
)
.doOnError { Timber.e(it) }
.onErrorReturn(::parseError) .onErrorReturn(::parseError)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(DealsScreenViewState::class.java), DealsScreen::render) subscribeViewState(state.cast(DealsScreenViewState::class.java), DealsScreen::render)
} }
} }
\ No newline at end of file
...@@ -74,7 +74,7 @@ class EstateScreenController : ...@@ -74,7 +74,7 @@ class EstateScreenController :
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
override fun tourCardClicked(): Observable<Int> = override fun tourCardClicked(): Observable<Int> =
startToourCard.clicks() tourScreen.clicks()
.map { 1 } .map { 1 }
.debounce(320L, TimeUnit.MILLISECONDS) .debounce(320L, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
...@@ -119,9 +119,6 @@ class EstateScreenController : ...@@ -119,9 +119,6 @@ class EstateScreenController :
@Inject @Inject
override lateinit var injectedPresenter: EstateScreenPresenter override lateinit var injectedPresenter: EstateScreenPresenter
@BindView(R.id.start_tour_image_view)
lateinit var startToourCard: View
@BindView(R.id.flatTypesCustomView) @BindView(R.id.flatTypesCustomView)
lateinit var flatTypeView: ViewGroup lateinit var flatTypeView: ViewGroup
......
...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.favorites ...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.favorites
import com.biganto.visual.roompark.conductor.BigantoBasePresenter import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.FavoritesInteractor import com.biganto.visual.roompark.domain.interactor.FavoritesInteractor
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import timber.log.Timber import timber.log.Timber
...@@ -19,21 +20,28 @@ class FavoritesScreenPresenter @Inject constructor( ...@@ -19,21 +20,28 @@ class FavoritesScreenPresenter @Inject constructor(
: BigantoBasePresenter<FavoritesScreen, FavoritesScreenViewState>() { : BigantoBasePresenter<FavoritesScreen, FavoritesScreenViewState>() {
override fun defaultErrorViewStateHandler() = override fun defaultErrorViewStateHandler() =
{e: ExceptionString -> FavoritesScreenViewState.SomeError(e)} { e: ExceptionString -> FavoritesScreenViewState.SomeError(e) }
override fun bindIntents() { override fun bindIntents() {
val prefetchCards = interactor.getFavoritesForCurrentUser() val prefetchCards = interactor.getFavoritesForCurrentUser()
.map { FavoritesScreenViewState.FavoriteEstatesLoaded(it) } .map { FavoritesScreenViewState.FavoriteEstatesLoaded(it) }
val state = restoreStateObservable val state = Observable.mergeDelayError(
.mergeWith(prefetchCards) arrayListOf(
.doOnError{ Timber.e(it)} restoreStateObservable,
prefetchCards
)
)
.doOnError { Timber.e(it) }
.onErrorReturn(::parseError) .onErrorReturn(::parseError)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(FavoritesScreenViewState::class.java), FavoritesScreen::render) subscribeViewState(
state.cast(FavoritesScreenViewState::class.java),
FavoritesScreen::render
)
} }
} }
\ No newline at end of file
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