Created
December 12, 2019 17:47
-
-
Save hadilq/5e93c11fa55d8f840022ff5d50f6f96c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AlbumsViewModel : BaseViewModel { | |
private val networkErrorLiveData = BehaviorProcessor.create<Throwable>() | |
private val openAlbumDetailsLiveEvent = PublishProcessor.create<Album>() | |
fun albumsLiveData(): Flowable<List<Album>> = albumsLiveData.hide().observeOn(AndroidSchedulers.mainThread()) | |
fun networkErrorLiveData(): Flowable<Throwable> = | |
networkErrorLiveData.hide().observeOn(AndroidSchedulers.mainThread()) | |
fun postAlbums(albums: List<Album>) { | |
albumsLiveData.offer(albums) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment