Commit 991e8526 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

settings fix subs

album not switching issue
parent 29c64683
...@@ -34,6 +34,7 @@ import io.reactivex.Observable ...@@ -34,6 +34,7 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import jp.wasabeef.glide.transformations.BlurTransformation import jp.wasabeef.glide.transformations.BlurTransformation
import jp.wasabeef.glide.transformations.ColorFilterTransformation import jp.wasabeef.glide.transformations.ColorFilterTransformation
import timber.log.Timber
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
...@@ -178,10 +179,11 @@ class AlbumsScreenController : ...@@ -178,10 +179,11 @@ class AlbumsScreenController :
private fun render(viewState: AlbumsScreenViewState.SubscriptionStatus) { private fun render(viewState: AlbumsScreenViewState.SubscriptionStatus) {
val sw = toolBar.headerToolbar.findViewById<SwitchMaterial>(R.id.switch1) val sw = toolBar.headerToolbar.findViewById<SwitchMaterial>(R.id.switch1)
Timber.d()
if (sw.isChecked != viewState.subState) if (sw.isChecked != viewState.subState)
{ {
silentCheck = true silentCheck = true
sw.isChecked != sw.isChecked sw.isChecked = viewState.subState
} }
} }
......
...@@ -54,7 +54,7 @@ class AlbumsScreenPresenter @Inject constructor( ...@@ -54,7 +54,7 @@ class AlbumsScreenPresenter @Inject constructor(
val fetchSubscription = interactor.getSubscriptions(currentAlbumTopic) val fetchSubscription = interactor.getSubscriptions(currentAlbumTopic)
.doAfterNext { restoreModel.sub = it } .doAfterNext { restoreModel.sub = it }
.map<AlbumsScreenViewState> { AlbumsScreenViewState.SubscriptionStatus(it.state) } .map<AlbumsScreenViewState> { AlbumsScreenViewState.SubscriptionStatus(it.state) }
.startWith(Observable.just<AlbumsScreenViewState>(AlbumsScreenViewState.Idle())) // .startWith(Observable.just<AlbumsScreenViewState>(AlbumsScreenViewState.Idle()))
val fetchParents = interactor.fetchHeaderAlbums() val fetchParents = interactor.fetchHeaderAlbums()
.filter { !it.isNullOrEmpty() } .filter { !it.isNullOrEmpty() }
...@@ -63,13 +63,18 @@ class AlbumsScreenPresenter @Inject constructor( ...@@ -63,13 +63,18 @@ class AlbumsScreenPresenter @Inject constructor(
val fetchSelected = requestAlbum(selectedIndex) val fetchSelected = requestAlbum(selectedIndex)
val headerItemSelected = intent(AlbumsScreen::onAlbumSelected) val headerItemSelected =
Observable.mergeDelayError(
arrayListOf(
intent(AlbumsScreen::onAlbumSelected)
.doOnNext { selectedIndex = it.albumId } .doOnNext { selectedIndex = it.albumId }
.doOnNext { restoreModel.currentIndex = it.albumId } .doOnNext { restoreModel.currentIndex = it.albumId }
.flatMap<AlbumsScreenViewState> { model -> .flatMap<AlbumsScreenViewState> { model ->
requestAlbum(model.albumId) requestAlbum(model.albumId)
.startWith(Observable.just(AlbumsScreenViewState.HeaderAlbumChoosed(item = model))) .startWith(Observable.just<AlbumsScreenViewState>(AlbumsScreenViewState.HeaderAlbumChoosed(item = model))
} )
}, fetchSubscription))
......
...@@ -204,7 +204,7 @@ class DealScreenController : ...@@ -204,7 +204,7 @@ class DealScreenController :
if (sw.isChecked != viewState.subState) if (sw.isChecked != viewState.subState)
{ {
silentCheck = true silentCheck = true
sw.isChecked != sw.isChecked sw.isChecked = viewState.subState
} }
} }
......
...@@ -89,7 +89,7 @@ class SettingsScreenPresenter @Inject constructor( ...@@ -89,7 +89,7 @@ class SettingsScreenPresenter @Inject constructor(
val refreshInfo = intent(SettingsScreen::refreshCacheInfo) val refreshInfo = intent(SettingsScreen::refreshCacheInfo)
.flatMap { fetchSettings } .flatMap { fetchCache }
val onClearCache = intent(SettingsScreen::clearCache) val onClearCache = intent(SettingsScreen::clearCache)
.flatMap { .flatMap {
...@@ -100,6 +100,7 @@ class SettingsScreenPresenter @Inject constructor( ...@@ -100,6 +100,7 @@ class SettingsScreenPresenter @Inject constructor(
) )
} }
.startWith(SettingsScreenViewState.OnCacheDeleting(0f)) .startWith(SettingsScreenViewState.OnCacheDeleting(0f))
.doOnError { Timber.e(it) }
.onErrorReturn(::parseError) .onErrorReturn(::parseError)
} }
......
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