Refactored usages of coroutine scopes to apply the following rules:
1) Created mainScope in ContextGraph. It used in all services and repositories whose scope should be active throughout the whole SDK/app lifetime. It never cancels.
2) Dispatchers.Main.immediate used only in components responsible to update the UI (activity/VM/interactor) and bound to component lifecycle.
3) Short lived components (like PODefaultProxy3DSService) have it's own MainScope() which is cancelled when component is not needed anymore.
4) Other components will use the scope of parent component whenever possible (e.g. launchers use lifecycleScope).
Description
Refactored usages of coroutine scopes to apply the following rules: 1) Created
mainScope
inContextGraph
. It used in all services and repositories whose scope should be active throughout the whole SDK/app lifetime. It never cancels. 2)Dispatchers.Main.immediate
used only in components responsible to update the UI (activity/VM/interactor) and bound to component lifecycle. 3) Short lived components (likePODefaultProxy3DSService
) have it's ownMainScope()
which is cancelled when component is not needed anymore. 4) Other components will use the scope of parent component whenever possible (e.g. launchers uselifecycleScope
).