Skip to content

Commit

Permalink
fix: set correct User-Agent for Android and returns session recording…
Browse files Browse the repository at this point in the history
… even if authorized domains is enabled (#125)
  • Loading branch information
marandaneto authored Apr 24, 2024
1 parent 592109b commit 1dd4b0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 4 additions & 1 deletion posthog/src/main/java/com/posthog/PostHogConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions posthog/src/test/java/com/posthog/PostHogConfigTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1dd4b0b

Please sign in to comment.