From 457684cc6ec42fb17809eb8fb232d7ecea042f35 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:09:39 +0200 Subject: [PATCH] chore: set the right sdk name and version (#5) --- CHANGELOG.md | 4 ++++ .../PosthogReactNativeSessionReplayModule.kt | 6 ++++++ ios/PosthogReactNativeSessionReplay.swift | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2891ab..74d33d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/android/src/main/java/com/posthogreactnativesessionreplay/PosthogReactNativeSessionReplayModule.kt b/android/src/main/java/com/posthogreactnativesessionreplay/PosthogReactNativeSessionReplayModule.kt index 27543c7..06e241b 100644 --- a/android/src/main/java/com/posthogreactnativesessionreplay/PosthogReactNativeSessionReplayModule.kt +++ b/android/src/main/java/com/posthogreactnativesessionreplay/PosthogReactNativeSessionReplayModule.kt @@ -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 @@ -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) diff --git a/ios/PosthogReactNativeSessionReplay.swift b/ios/PosthogReactNativeSessionReplay.swift index bf3951c..e95cb64 100644 --- a/ios/PosthogReactNativeSessionReplay.swift +++ b/ios/PosthogReactNativeSessionReplay.swift @@ -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