Skip to content

Commit

Permalink
fix: respects the flushAt flag (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Nov 19, 2024
1 parent 68ad9fd commit f337576
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
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.7 - 2024-11-19

- fix: respects the flushAt flag

## 0.1.6 - 2024-10-25

- chore: forces the SDK to be initialized on the main thread
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "com.posthog:posthog-android:3.8.3"
implementation "com.posthog:posthog-android:3.9.2"
}

Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ class PosthogReactNativeSessionReplayModule(reactContext: ReactApplicationContex
val anonymousId = sdkOptions.getString("anonymousId") ?: ""
val theSdkVersion = sdkOptions.getString("sdkVersion")

var theFlushAt = 20
if (sdkOptions.hasKey("flushAt")) {
theFlushAt = sdkOptions.getInt("flushAt")
}

val config = PostHogAndroidConfig(apiKey, host).apply {
debug = debugValue
captureDeepLinks = false
captureApplicationLifecycleEvents = false
captureScreenViews = false
flushAt = theFlushAt
sessionReplay = true
sessionReplayConfig.screenshot = true
sessionReplayConfig.captureLogcat = captureLog
Expand Down
3 changes: 3 additions & 0 deletions ios/PosthogReactNativeSessionReplay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class PosthogReactNativeSessionReplay: NSObject {

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

let flushAt = sdkOptions["flushAt"] as? Int ?? 20
config.flushAt = flushAt

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

0 comments on commit f337576

Please sign in to comment.