Chethan
01/24/2022, 6:07 PMobserver = Observer<Resource<List<DisplayCard>>> {
when (it.status) {
Status.SUCCESS -> {
// setting list to emit card for every 2 minutes once
ambientDisplayViewModel.setListOfCards(it.data ?: emptyList())
// removing observer
ambientDisplayViewModel.ambientCardList.removeObservers(viewLifecycleOwner)
}
Status.LOADING -> {
}
Status.ERROR -> {
ambientDisplayViewModel.refresh(DataSource(loadFromNetwork = false))
}
}
}
With above code , I have received review comments from my peer as below
"Viewmodel callback should come to activity/fragment only when there's an intention to update the view." , Do you agree on this quote ? Do you think that I shouldn't keep callback when I am not making any UIUmar Ata
01/24/2022, 6:11 PM