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