Update kotlinx-coroutines to version 1.6.0

This commit is contained in:
cketti 2022-03-01 19:22:19 +01:00
parent 2c86c196ac
commit 4c67bbd156
2 changed files with 4 additions and 4 deletions

View file

@ -5,13 +5,13 @@ import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.FlowCollector
import kotlinx.coroutines.launch
fun <T> Flow<T>.observe(lifecycleOwner: LifecycleOwner, action: suspend (T) -> Unit) {
fun <T> Flow<T>.observe(lifecycleOwner: LifecycleOwner, collector: FlowCollector<T>) {
lifecycleOwner.lifecycleScope.launch {
lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
collect(action)
collect(collector)
}
}
}

View file

@ -12,7 +12,7 @@ buildscript {
versions = [
'kotlin': '1.6.10',
'kotlinCoroutines': '1.5.2',
'kotlinCoroutines': '1.6.0',
'androidxAppCompat': '1.3.1',
'androidxActivity': '1.4.0',
'androidxRecyclerView': '1.2.1',