apollo-android v2.4.0 Release Notes
Release Date: 2020-09-22 // over 3 years ago-
๐ Version 2.4.0 brings multiple new features and bugfixes. Read below for the most important changes and full changelog
๐ Experimental Multi-Modules support
๐ Version 2.4.0 brings Multi-Modules support. With Multi-Modules, you can reuse GraphQL fragments from different Gradle modules for better separation of concerns and improved build speed.
๐ Configure your parent module to generate Apollo metadata:
// parent/build.gradle.ktsapollo { generateApolloMetadata.set(true) }
And declare your parent module as a dependency of your feature module:
// feature/build.gradle.ktsdependencies { implementation("com.apollographql.apollo:apollo-runtime:xyz") // more regular dependencies// Apollo dependencies apolloMetadata(project(":parent")) // You still need to declare the parent module as a regular dependency implementation(project(":parent")) }
๐ For more information, read the official documentation
๐ฑ โ ๏ธ Multi-Modules is currently experimental and we'd love to hear how it worked (or not worked) for you. We welcome issues/feedback through the Github Issues
SDL schemas improvements
๐ Version 2.4.0 brings even more fixes and tools to work with SDL schemas. SDL schemas are a more concise and readable way to work with GraphQL schemas. To use them, replace
schema.json
with your SDL schemaschema.sdl
. You can get a SDL schema from your GraphQL Playground if your endpoint has an associated Playground instance. If you don't have a playground instance or another way to download a SDL file, version 2.4.0 can make an introspection query and save it in SDL format. The schema will be saves as Json or SDL depending on the filename extension:./gradlew downloadApolloSchema --endpoint https://your.graphql/endpoint --schema src/main/graphql/com/example/schema.sdl
Coroutines
๐ If you're using
apollo-coroutines-support
, version 2.4.0 bringsapolloCall.await()
(#2574). It is more concise than the previousapolloCall.toDeferred().await()
and also respects structured concurrency. We strongely encourage to move to.await()
. Many thanks to @R4md4c for adding this!Kotlin 1.4.10
โ The Kotlin 1.4.10 ecosystem is moving forward and we bumped a few dependencies (sqldeligh, okio, kotlin-compile-testing, coroutines and obviously kotlin).
๐ The Gradle plugin is also compiled against Kotlin 1.4.10 despite Gradle forcing Kotlin 1.3.72 at runtime. We compile with
apiVersion = "1.3"
and our tests do not show any issue but please let us know if you see any weird Gradle behaviour.FileUpload
๐ Version 2.4.0 fixes how files were written in variables (#2566) and allows to subclass
FileUpload
to make it work without aFile
. With Android 11 and scoped storage out of the door, this will allow to upload from a content uri or any other data source. The API was inspired by OkHttpRequestBody
. If you ever used OkHttp before, you shouldn't be disoriented:object upload : FileUpload(mimetype) { override fun contentLength(): Long { TODO("return contentLength here") } override fun fileName(): String? { TODO("return fileName to use in the multipart request here") } override fun writeTo(sink: BufferedSink) { TODO("write the data here") } }
Full Changelog
๐ฑ โจ New
- ๐ Multi-module support (#2514)
- ๐ [Plugin] Allow to download SDL schemas (#2586)
- ๐ [Plugin] Add an option to fail on deprecated usages (#2575)
- [FileUpload] allow to sub class FileUpload (#2569)
- [FileUpload] Allow to encode custom scalar types as null and use it for file uploads (#2566)
- ๐ [Coroutines] Add
ApolloCall.await
with better structured concurrency support. (#2574)
๐ท ๐ทโโ๏ธ Fixes
- [RxJava] fix
retry()
(#2587) - [SDL] Fix a scalar definition after a union defintion (#2559)
- [Compiler] fix optional Int properties with an uppercase name (#2543)
- [SQLNormalizedCache] fix watcher not called on initial cache write (#2538)
๐ฑ โ๏ธ Internal
- โก๏ธ Update CI to use
main
instead ofmaster
(#2594) - โก๏ธ Update LICENSE with new organization name (#2584)
- โ Add Kotlin as language for the codeblock (#2580)
- โฌ๏ธ Bump Kotlin to 1.4.10 (#2578)
- โฌ๏ธ Bump sql delight version to 1.4.3 (#2564)
- Compile Kotlin against stdlib 1.3 (#2555)
- Put the location of the .xcodeproj file for Kotlin Multiplatform Mobile integration in Android Studio (#2554)
- ๐ [Plugin] allow running the plugin on Gradle 5.6 (#2539)
- โฌ๏ธ Bump kotlin compile testing (#2547)
๐ฑ โค๏ธ External contributors
๐ Many thanks to @R4md4c, @dush1729, @jaggs6 for their awesome work on coroutines, documentation and keeping the project in good shape in general!