You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support for canceling coroutines when Activity is destroyed is missing. FeedStore has hardcoded CoroutineScope(Dispatchers.Main) which is not bound to any lifecycle callbacks.
This hardcoded coroutine scope also makes writing unit tests hard (it could be simply a constructor parameter).
The text was updated successfully, but these errors were encountered:
lukasz-kalnik-gcx
changed the title
Handle cancelation on Activity lifecycle callbacks
Handle coroutine cancelation on Activity lifecycle callbacks
Nov 30, 2021
You are right. To inject CoroutineScope is good and right idea.
But for our case it doesn't matter because FeedStore lives with Application lifecycle. And will be destroyed with app process.
e.g. the FeedStore is needed not only for Activity but for background update service too.
Ok, understand. Thank you for the explanation.
Then as a feature request it would be helpful to also have an example of a screen which is canceling a coroutine when it closes. This is a quite common use case and would be good to see some best practices how it can be done from Android and iOS side.
Support for canceling coroutines when Activity is destroyed is missing.
FeedStore
has hardcodedCoroutineScope(Dispatchers.Main)
which is not bound to any lifecycle callbacks.This hardcoded coroutine scope also makes writing unit tests hard (it could be simply a constructor parameter).
The text was updated successfully, but these errors were encountered: