Hey :android: developers, here are 2 `coroutineSco...
# coroutines
l
Hey 🤖 developers, here are 2
coroutineScope
extensions for
Lifecycle
and
LifecycleOwner
(that you can use in AppCompatActivities, Fragments, LifecycleServices...) for changes in kotlinx.coroutines 0.26.0: https://gist.github.com/LouisCAD/58d3017eedb60ce00721cb32a461980f#file-lifecyclejob-kt-L30
🎉 3
👍 2
e
Maybe PR into Android module of
kotlinx.coroutiines
?
3
l
I'd like to! It depends on Android architecture components (and AndroidX for the bleeding edge), not on the Android platform alone. Is there a module with such dependencies allowed?
e
Hm…. Shall we create a separate integration module for Android architecuter components then? (that would be also a good place to put livedata integration)
l
Mostly yes. I think there should be at least one module for lifecycles, and one for the AndroidX version (unless Google provides a better way for library developers...). For LiveData, I'm not sure every app would need the integration (I may be wrong, tell me if so), so I think it should belong to another module.
@elizarov Let me know if you need any suggestions for modules naming, or anything related to this. I'll be happy to help and then make a PR for this
t
and one for the AndroidX version
oh yeah, eap+androidx = combinatorial explosion
e
It obviously has to be
kotlinx-coroutines-xxx
. Is there a short name for android architecture components?
t
android-arch
👍 1
Copy code
// alternatively - just LiveData
    implementation "android.arch.lifecycle:livedata:$lifecycle_version"
https://developer.android.com/topic/libraries/architecture/adding-components#kotlin
and androidx version -
Copy code
// alternatively - just LiveData
    implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
l
I think you should have
kotlinx-coroutines-android-arch-lifecycle
and
kotlinx-coroutines-androidx-lifecycle
t
There is also ReactiveStreams module (though I haven't tried it and cannot say anyhting):
Copy code
// optional - ReactiveStreams support for LiveData
    implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version" // use -ktx for Kotlin
And probably most challenging option - room+coroutines like rxjava2:
Copy code
// optional - RxJava support for Room
    implementation "android.arch.persistence.room:rxjava2:$room_version"
l
AndroidX separated everything so you can depend on just Lifecycle artifact without bringing LiveData and other things (which RxJava users often don't use, and coroutines users don't always use, if they do). kotlinx.coroutines should not remove this benefit (although that multiplies artifacts for Android, this is a good thing as not all apps need all libraries, and same goes for libraries depending on libraries)
e
Let’s start with individual integration modules then
👍 1
l
@elizarov Please let me know when you've created the modules we talked about. I'd like to start working on a PR this weekend if possible.
e
They should be created in the same PR. More details in contributions guide: https://github.com/Kotlin/kotlinx.coroutines/tree/master/integration#contributing
👍 1
l