apollo-android v3.5.0 Release Notes

  • 2022-08-01

    ๐Ÿš€ With this release, Apollo Kotlin now uses Kotlin Native's new memory model. It also contains a number of other improvements and bug fixes.

    ๐Ÿ’™๏ธ External contributors

    Many thanks to @glureau for carefully adding new watch targets โŒš๐Ÿ’™.

    โœจ๏ธ [new] Kotlin Native: new memory manager (#4287)

    ๐ŸŽ Apollo Kotlin is now requiring applications to use the new memory manager, a.k.a. new memory model. Thanks to this change, the restriction that operations had to be executed from the main thread on Apple targets is now removed. You can also use kotlinx.coroutines.test.runTest. Last but not least, benchmarks seem to indicate that performance is better under the new memory manager!

    โœจ๏ธ [new] @targetName directive (#4243)

    ๐Ÿ”ง This directive was introduced in v3.3.1 to allow overriding the name of enum values in the generated code. It has now been extended to allow configuring the generated name of Interfaces, Enums, Unions, Scalars and Input objects. This can be used to make the generated code nicer to use, or to avoid name clashes with Kotlin types (e.g. Long) in Kotlin Native.

    ๐Ÿ”Œ โœจ๏ธ [new] Automatic resolution of Apollo artifacts versions from the plugin version (#4279)

    โฌ†๏ธ From now on, you no longer need to specify explicitly the versions of Apollo dependencies: if omitted, the same version as the Apollo Gradle plugin will be used. This should facilitate upgrades and avoid potential mistakes:

    plugins {
      plugins {
        id("org.jetbrains.kotlin.jvm").version("1.7.10")
        id("com.apollographql.apollo3").version("3.5.0")
      }
    
      dependencies {
        // Replace this
        // implementation("com.apollographql.apollo3:apollo-runtime:3.5.0")
    
        // with
        implementation("com.apollographql.apollo3:apollo-runtime")
      }
    }
    
    

    โœ… ๐Ÿšง [deprecated] runTest (#4292)

    โœ… With the new memory model, Apollo's specific runTest method from apollo-testing-support is no longer useful and has been deprecated. If you were using it, you should now be able to use Kotlin's runTest instead, or simply runBlocking.

    ๐Ÿšง [breaking] Automatic detection of type enum values.

    ๐Ÿšš If you have an enum with a type value, this value used to name clash with the generated type property. This version now detects this case automatically and escapes type to type_. If you had previously used @targetName to workaround this issue, you can now remove it to avoid it being escaped twice: