Commit bfff288e authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

Merge branch 'feature/restore_feed_list' into develop

parents 103bc906 1ed11136
...@@ -89,7 +89,6 @@ class ArticlesScreenController : ...@@ -89,7 +89,6 @@ class ArticlesScreenController :
lateinit var emptyListNotice: MaterialTextView lateinit var emptyListNotice: MaterialTextView
private fun setToolbar() { private fun setToolbar() {
articlesRecyclerView.isNestedScrollingEnabled = false articlesRecyclerView.isNestedScrollingEnabled = false
......
...@@ -54,18 +54,18 @@ class ArticlesScreenPresenter @Inject constructor( ...@@ -54,18 +54,18 @@ class ArticlesScreenPresenter @Inject constructor(
} }
val fetchSubscription = interactor.getSubscriptions(feedId) val fetchSubscription = interactor.getSubscriptions(feedId)
.doOnNext { Timber.w("got smthng: $it") }
.doAfterNext { restoreModel.sub = it } .doAfterNext { restoreModel.sub = it }
.map<ArticlesScreenViewState> { ArticlesScreenViewState.SubscriptionStatus(it.state) } .map<ArticlesScreenViewState> { ArticlesScreenViewState.SubscriptionStatus(it.state) }
.startWith(Observable.just<ArticlesScreenViewState>(ArticlesScreenViewState.Idle())) .startWith(Observable.just<ArticlesScreenViewState>(ArticlesScreenViewState.Idle()))
val prefetchCards = interactor.fetchArticles(feedId) val prefetchCards = interactor.fetchArticles(feedId)
.doOnNext { restoreModel.articles.addAll(it.articles) }
.map<ArticlesScreenViewState> { ArticlesScreenViewState.ArticlesLoaded(it.articles) } .map<ArticlesScreenViewState> { ArticlesScreenViewState.ArticlesLoaded(it.articles) }
.startWith(Observable.just<ArticlesScreenViewState>(ArticlesScreenViewState.Idle())) .startWith(Observable.just<ArticlesScreenViewState>(ArticlesScreenViewState.Idle()))
val getNewArticlesPage = intent(ArticlesScreen::requsetsNewArticles) val getNewArticlesPage = intent(ArticlesScreen::requsetsNewArticles)
.flatMap { .flatMap {currentItem ->
interactor.fetchArticlesPage(feedId, FEED_PAGE_SIZE, it) interactor.fetchArticlesPage(feedId, FEED_PAGE_SIZE, currentItem)
.map<ArticlesScreenViewState> { articlePage -> .map<ArticlesScreenViewState> { articlePage ->
articlePage.articles articlePage.articles
.asSequence() .asSequence()
......
...@@ -18,3 +18,4 @@ sealed class ArticlesScreenViewState : BigantoBaseViewState() { ...@@ -18,3 +18,4 @@ sealed class ArticlesScreenViewState : BigantoBaseViewState() {
class SubscriptionStatus(val subState: Boolean) : ArticlesScreenViewState() class SubscriptionStatus(val subState: Boolean) : ArticlesScreenViewState()
class SubscriptionError(val subState: Boolean) : ArticlesScreenViewState() class SubscriptionError(val subState: Boolean) : ArticlesScreenViewState()
} }
...@@ -17,6 +17,7 @@ import com.bluelinelabs.conductor.changehandler.FadeChangeHandler ...@@ -17,6 +17,7 @@ import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import com.google.android.material.textfield.TextInputLayout import com.google.android.material.textfield.TextInputLayout
import com.jakewharton.rxbinding3.material.selections
import com.jakewharton.rxbinding3.view.clicks import com.jakewharton.rxbinding3.view.clicks
import com.jakewharton.rxbinding3.view.keys import com.jakewharton.rxbinding3.view.keys
import com.jakewharton.rxbinding3.widget.afterTextChangeEvents import com.jakewharton.rxbinding3.widget.afterTextChangeEvents
...@@ -55,10 +56,13 @@ class FindFlatScreenController : ...@@ -55,10 +56,13 @@ class FindFlatScreenController :
override fun getFlat(): Observable<FlatRequestModel> = override fun getFlat(): Observable<FlatRequestModel> =
flatNumberEditor.afterTextChangeEvents()// keys{ it.keyCode == KeyEvent.KEYCODE_ENTER } flatNumberEditor.afterTextChangeEvents()// keys{ it.keyCode == KeyEvent.KEYCODE_ENTER }
.map { 1 }
.mergeWith(
flatTabs.selections().map { 1 }
)
.filter { flatNumberInput.editText?.text?.isNotEmpty()?:false } .filter { flatNumberInput.editText?.text?.isNotEmpty()?:false }
.map { .mergeWith(flatTabs.clicks().map { 1 })
flatModel .map {flatModel}
}
.debounce (120,TimeUnit.MILLISECONDS) .debounce (120,TimeUnit.MILLISECONDS)
.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