apollo-android v2.4.0 Release Notes

Release Date: 2020-09-22 // about 1 year 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 schema schema.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 brings apolloCall.await() (#2574). It is more concise than the previous apolloCall.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 a File. 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 OkHttp RequestBody. 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 of master (#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!