Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
UDF + Unit Tests - ViewModel
class ContentViewModel : ViewModel(), ContentViewEvents {
val feedViewState: LiveData<FeedViewState> get() = _feedViewState
val viewEffect: LiveData<ContentEffects> get() = _viewEffect
private val _feedViewState = MutableLiveData<FeedViewState>()
private val _viewEffect = MutableLiveData<ContentEffects>()
override fun feedLoad(event: FeedLoad) {
_feedViewState.value = FeedViewState(
feedType = event.feedType,
timeframe = event.timeframe,
toolbar = setToolbar(event.feedType),
contentList = getContentList(event, event.feedType, event.isRealtime, getTimeframe(event.timeframe)))
_viewEffect.value = ContentEffects(updateAds = liveData { emit(Event(UpdateAdsEffect())) })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.