Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: set the right sdk name and version #5

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading