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