diff --git a/CHANGELOG.md b/CHANGELOG.md index a73c1848..381740c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,16 @@ ## Next +## 3.1.18 - 2024-04-24 + +- fix: set correct `User-Agent` for Android and returns session recording even if authorized domains is enabled ([#125](https://github.com/PostHog/posthog-android/pull/125)) + ## 3.1.17 - 2024-04-11 -recording: multiple fixes for better frame rate, padding, drawables ([#118](https://github.com/PostHog/posthog-android/pull/118)) +- recording: multiple fixes for better frame rate, padding, drawables ([#118](https://github.com/PostHog/posthog-android/pull/118)) ## 3.1.16 - 2024-03-27 -fix: add replay props only if replay is enabled ([#112](https://github.com/PostHog/posthog-android/pull/112)) +- fix: add replay props only if replay is enabled ([#112](https://github.com/PostHog/posthog-android/pull/112)) ## 3.1.15 - 2024-03-08 diff --git a/posthog/src/main/java/com/posthog/PostHogConfig.kt b/posthog/src/main/java/com/posthog/PostHogConfig.kt index 2da4f13d..2cf8d5eb 100644 --- a/posthog/src/main/java/com/posthog/PostHogConfig.kt +++ b/posthog/src/main/java/com/posthog/PostHogConfig.kt @@ -113,7 +113,10 @@ public open class PostHogConfig( @PostHogInternal public var sdkVersion: String = BuildConfig.VERSION_NAME - internal val userAgent: String = "$sdkName/$sdkVersion" + internal val userAgent: String + get() { + return "$sdkName/$sdkVersion" + } @PostHogInternal public var legacyStoragePrefix: String? = null diff --git a/posthog/src/test/java/com/posthog/PostHogConfigTest.kt b/posthog/src/test/java/com/posthog/PostHogConfigTest.kt index 73d03944..eb93890e 100644 --- a/posthog/src/test/java/com/posthog/PostHogConfigTest.kt +++ b/posthog/src/test/java/com/posthog/PostHogConfigTest.kt @@ -80,6 +80,12 @@ internal class PostHogConfigTest { assertEquals(BuildConfig.VERSION_NAME, config.sdkVersion) } + @Test + fun `user agent is returned correctly if changed`() { + config.sdkName = "posthog-android" + assertEquals("posthog-android/${BuildConfig.VERSION_NAME}", config.userAgent) + } + @Test fun `user agent is set the java sdk by default`() { assertEquals("posthog-java/${BuildConfig.VERSION_NAME}", config.userAgent)