Skip to content

Commit

Permalink
chore: set the right sdk name and version (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Sep 30, 2024
1 parent a2b0c13 commit 457684c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Next

## 0.1.2 - 2024-09-24

- chore: set the right sdk name and version

## 0.1.1 - 2024-09-24

- fix: session replay plugin isn't properly identifying users already identified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class PosthogReactNativeSessionReplayModule(reactContext: ReactApplicationContex

val distinctId = sdkOptions.getString("distinctId") ?: ""
val anonymousId = sdkOptions.getString("anonymousId") ?: ""
val theSdkVersion = sdkOptions.getString("sdkVersion")

val config = PostHogAndroidConfig(apiKey, host).apply {
debug = debugValue
Expand All @@ -58,6 +59,11 @@ class PosthogReactNativeSessionReplayModule(reactContext: ReactApplicationContex
if (!endpoint.isNullOrEmpty()) {
snapshotEndpoint = endpoint
}

if (!theSdkVersion.isNullOrEmpty()) {
sdkName = "posthog-react-native"
sdkVersion = theSdkVersion
}
}
PostHogAndroid.setup(context, config)

Expand Down
7 changes: 7 additions & 0 deletions ios/PosthogReactNativeSessionReplay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class PosthogReactNativeSessionReplay: NSObject {
let distinctId = sdkOptions["distinctId"] as? String ?? ""
let anonymousId = sdkOptions["anonymousId"] as? String ?? ""

let sdkVersion = sdkOptions["sdkVersion"] as? String ?? ""

if !sdkVersion.isEmpty {
postHogSdkName = "posthog-react-native"
postHogVersion = sdkVersion
}

PostHogSDK.shared.setup(config)

self.config = config
Expand Down

0 comments on commit 457684c

Please sign in to comment.