bernaferrari/ChangeDetection

Callbacks and coroutines?

dmytrodanylyk opened this issue · 3 comments

Is there a reason why you have callbacks in your repositories and data source classes and use coroutines in your ViewModel?

I suggest making all public fun of repositories suspended. See this example.

Is there a reason why you have callbacks in your repositories and data source classes and use coroutines in your ViewModel?

Yes! Lack of knowledge!
I have only a few weeks from experience with coroutines (and a few months with rxjava), so these things are still kind of new and sometimes hard for me. The coroutines/suspend functions inside the app were supposed to simplify the cases where callbacks became unnecessary.

However.. after realising you did the hard work converting them, I went ahead and just pushed the app for full coroutines (totally inspired by your app, I had no idea the withContext(appExecutors.ioContext) could replace those ugly AppExecutors).

So, consider it done!
f2742df

Thanks for the feedback.
If you have any other comment, suggestion or feedback, I am open!

@dmytrodanylyk I am having the following regression since the full coroutines migration:

https://www.reddit.com/r/androiddev/comments/8rylh6/weekly_questions_thread_june_18_2018/e0z20bj

Any ideas on how to fix it?