processout / processout-android

https://www.processout.com
MIT License
2 stars 5 forks source link

fix(ad-hoc): Refactor coroutine scopes #219

Closed vitalii-vanziak-cko closed 2 months ago

vitalii-vanziak-cko commented 2 months ago

Description

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).