Commit 20e57d95 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

albums topic id by selected index

parent 420dfc3f
......@@ -68,7 +68,7 @@ class AlbumsScreenPresenter @Inject constructor(
}
val fetchSubscription = interactor.getSubscriptions(SubscriptionTopic.Progress_1())
val fetchSubscription = interactor.getSubscriptions(currentAlbumTopic)
.doAfterNext { restoreModel.sub = it }
.map<AlbumsScreenViewState> { AlbumsScreenViewState.SubscriptionStatus(it.state) }
.startWith(Observable.just<AlbumsScreenViewState>(AlbumsScreenViewState.Idle()))
......@@ -98,6 +98,14 @@ class AlbumsScreenPresenter @Inject constructor(
super.detachView()
restoreStateObservable.accept(AlbumsScreenViewState.RestoreView(restoreModel))
}
private val currentAlbumTopic = when(selectedIndex){
9 -> SubscriptionTopic.Progress_1()
10 -> SubscriptionTopic.Progress_2()
11 -> SubscriptionTopic.Progress_3()
106 -> SubscriptionTopic.Progress_kindergarden()
else -> error("unknown parent album type!")
}
}
data class RestoreModel(var albumList:List<AlbumSortedModel>
......
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