Update Kotlin coroutines
This commit is contained in:
@@ -172,7 +172,9 @@ dependencies {
|
||||
testImplementation "junit:junit:4.13.2"
|
||||
|
||||
// https://github.com/Kotlin/kotlinx.coroutines/releases
|
||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1"
|
||||
def coroutines_version = "1.6.1"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
|
||||
|
||||
// https://github.com/robolectric/robolectric/releases
|
||||
testImplementation "org.robolectric:robolectric:4.8.1"
|
||||
|
||||
@@ -4,11 +4,11 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.FlowCollector
|
||||
|
||||
inline fun <T> Fragment.collectWhenViewResumed(
|
||||
fun <T> Fragment.collectWhenViewResumed(
|
||||
flow: Flow<T>,
|
||||
crossinline collector: suspend (T) -> Unit,
|
||||
collector: FlowCollector<T>,
|
||||
) = launchWhenViewResumed { flow.collect(collector) }
|
||||
|
||||
fun Fragment.launchWhenViewResumed(
|
||||
|
||||
Reference in New Issue
Block a user