Skip to content

Fixed Logics for collecting multiple flows inside lifecycle scope.

Subhadip requested to merge Subhadiptech/agora-android:issue/444 into develop

Fixes #444

Changes :

  • Added repeatOnLifecycle() dependencies (implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0")
  • Added logics for collecting multiple flows as:

`

  lifecycleScope.launch {
        repeatOnLifecycle(Lifecycle.State.STARTED) {
           
            launch {
                flow1.collect { /* Handle */ }   
            }
            launch {
                flow2.collect { /* Handle */ }
            }
            launch {
                flow3.collect { /* Handle */ }
            }
        }
    }

`

Screenshots for the change :

Screenshot_2023-04-13_at_12.39.33_AM

Appetize link: https://appetize.io/app/x63j237cj2tjzgfwtv5fvk5qxa?device=pixel4&osVersion=11.0&scale=75

Edited by Subhadip

Merge request reports