Slackbot
09/15/2020, 7:42 AMSe7eN
09/15/2020, 9:59 AMsuspend function in repository and call it from the view model with the viewModelScope when it's created.Se7eN
09/15/2020, 10:01 AMSudhir Singh Khanger
09/15/2020, 10:47 AMSe7eN
09/15/2020, 11:24 AMSe7eN
09/15/2020, 11:26 AMbsimmons
09/15/2020, 11:37 AMviewModelScope is mostly to make sure that we don't send updates to non-existent activities.
The real question is why or when you would want to cancel a request.Adam Powell
09/15/2020, 2:14 PMdroid
09/15/2020, 2:19 PMrepository is doing needs to independent of the UI, then we can use GlobalScope, else it should have suspend function called from within the viewModelScope as @Se7eN said.Sudhir Singh Khanger
09/16/2020, 5:05 AMviewModelScope will deliver the results in the ViewModel itself. Is that correct? That means the suspend function in the repository mostly act like a common method which can be called from different `ViewModel`s wherever the data would be needed.droid
09/16/2020, 12:18 PM