@posthog/react-native-plugin 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -85,6 +85,6 @@ dependencies {
|
|
|
85
85
|
//noinspection GradleDynamicVersion
|
|
86
86
|
implementation "com.facebook.react:react-native:+"
|
|
87
87
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
88
|
-
implementation "com.posthog:posthog-android:3.
|
|
88
|
+
implementation "com.posthog:posthog-android:3.52.0"
|
|
89
89
|
}
|
|
90
90
|
|
package/android/src/main/java/com/posthogreactnativeplugin/PosthogReactNativePluginModule.kt
CHANGED
|
@@ -93,6 +93,13 @@ class PosthogReactNativePluginModule(
|
|
|
93
93
|
val theSdkVersion = getString(sdkOptions, "sdkVersion", "")
|
|
94
94
|
val theFlushAt = getInt(sdkOptions, "flushAt", DEFAULT_FLUSH_AT)
|
|
95
95
|
|
|
96
|
+
// Forward custom headers (e.g. Authorization for a reverse proxy) so the native SDK
|
|
97
|
+
// attaches them to the requests it sends directly (session replay, crash uploads).
|
|
98
|
+
val theRequestHeaders =
|
|
99
|
+
getMap(sdkOptions, "requestHeaders")?.toHashMap()
|
|
100
|
+
?.filterValues { it is String }
|
|
101
|
+
?.mapValues { it.value as String }
|
|
102
|
+
|
|
96
103
|
val config =
|
|
97
104
|
PostHogAndroidConfig(apiKey, host).apply {
|
|
98
105
|
debug = debugValue
|
|
@@ -100,6 +107,7 @@ class PosthogReactNativePluginModule(
|
|
|
100
107
|
captureApplicationLifecycleEvents = false
|
|
101
108
|
captureScreenViews = false
|
|
102
109
|
flushAt = theFlushAt
|
|
110
|
+
theRequestHeaders?.let { requestHeaders = it }
|
|
103
111
|
errorTrackingConfig.autoCapture = nativeErrorTrackingAutocapture
|
|
104
112
|
|
|
105
113
|
// Keep the native exception-steps buffer aligned with the JS layer (one logical buffer).
|
|
@@ -178,6 +178,13 @@ class PosthogReactNativePlugin: NSObject {
|
|
|
178
178
|
let flushAt = sdkOptions["flushAt"] as? Int ?? 20
|
|
179
179
|
config.flushAt = flushAt
|
|
180
180
|
|
|
181
|
+
// Forward custom headers (e.g. Authorization for a reverse proxy) so the native SDK
|
|
182
|
+
// attaches them to the requests it sends directly (session replay, crash uploads).
|
|
183
|
+
// Keep only string values so a stray non-string doesn't drop every header (matches Android).
|
|
184
|
+
if let rawHeaders = sdkOptions["requestHeaders"] as? [String: Any] {
|
|
185
|
+
config.requestHeaders = rawHeaders.compactMapValues { $0 as? String }
|
|
186
|
+
}
|
|
187
|
+
|
|
181
188
|
if !sdkVersion.isEmpty {
|
|
182
189
|
postHogSdkName = "posthog-react-native"
|
|
183
190
|
postHogVersion = sdkVersion
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
|
|
|
6
6
|
# Single source of truth for the posthog-ios native dependency version.
|
|
7
7
|
# Used by both the SPM and CocoaPods resolution paths below; bump this
|
|
8
8
|
# line when picking up a new posthog-ios release.
|
|
9
|
-
posthog_ios_version = '3.
|
|
9
|
+
posthog_ios_version = '3.63.0'
|
|
10
10
|
|
|
11
11
|
Pod::Spec.new do |s|
|
|
12
12
|
s.name = "posthog-react-native-plugin"
|