Skip to content

chore!: adopt posthog-android 4.0, core 7.0 and posthog-ios 4.0 - #108

Draft
turnipdabeets wants to merge 2 commits into
mainfrom
chore/adopt-native-4.0
Draft

turnipdabeets wants to merge 2 commits into
mainfrom
chore/adopt-native-4.0

Conversation

@turnipdabeets

Copy link
Copy Markdown
Collaborator

Important

Draft until posthog-android 4.0.0 (+ core 7.0.0) and posthog-ios 4.0.0 are released. CI fails until then: the pinned versions don't exist yet. The TODOs in gradle/libs.versions.toml and PostHog.apple.kt mark what's left.

💡 Motivation and Context

Adopts the native 4.0 majors (PostHog/posthog-android#871, PostHog/posthog-ios#873), which send events through capture v1. KMP has no HTTP code of its own, so the native bump is all it takes to move Android, JVM and Apple targets to v1. JS/Wasm use posthog-js and are unaffected.

Code changes for the 4.0 API:

Change Why
macosMinimumDeploymentTarget 10.15 → 11.0 posthog-ios 4.0 minimum
debouncerDelayMs → throttleDelayMs (Android) deprecated alias removed
coreConfig.apiKey → projectToken (JVM) deprecated alias removed
reloadFeatureFlagsWithCallback { _ -> … } (Apple) callback now receives the load result
Drop sessionReplayConfig.screenshotMode (iOS) iOS always records masked screenshots; screenshot KDoc now says Android only
Tests: PostHogFeatureFlagsCallback, trailing options argument new native signatures

Still to do before merging:

  • Confirm the three versions once released, and regenerate .swiftpm-locks/.../Package.resolved against the 4.0.0 tag.
  • iOS attribution. Capture v1 drops $lib/$lib_version from properties and reads them from the PostHog-Sdk-Info header, which comes from a Swift-only global KMP can't set. Today every Apple event would report as posthog-ios. Once posthog-ios adds an ObjC setter, call it in platformSetup, remove the $lib stamping, and make PostHogAppleTest assert on the sent request (it currently checks inside beforeSend, so it passes either way). Android/JVM are fine: sdkName/sdkVersion already feed the header.
  • Decide whether to add a KMP throttleDelayMs and deprecate SessionRecordingConfig.debouncerDelayMs.

💚 How did you test it?

Built against the unreleased 4.0 branches (Android/core from a local Maven repo, posthog-ios via localSwiftPackage):

  • jvmTest 72/72, testAndroidHostTest 54/54, iosSimulatorArm64Test 45/45, macosArm64Test 45/45, detekt, and the sample app builds.
  • A macOS run against a stub server confirmed the $lib gap above.

Not yet: the E2E harness against a live project, and remote SwiftPM resolution (no 4.0.0 tag).

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm change to generate a change intent file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Claude Opus 5.5) built KMP against the merged 4.0 stacks of both native SDKs, fixed each compile and test failure, and found the iOS $lib gap with a stub-server run. The ObjC setter is left as a TODO because it doesn't exist in posthog-ios yet.

🤖 Generated with Claude Code

@turnipdabeets turnipdabeets self-assigned this Oct 28, 2026
@sampo-s-bot

sampo-s-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

⚠️ No changeset detected

No new .sampo/changesets/*.md files were detected in this PR. To add one:

  • run sampo add
  • follow the prompts to pick the affected packages and describe the change
  • commit the generated file to this pull request, and it will be detected automatically

If this PR isn't supposed to introduce any changes (e.g., documentation updates), you can ignore this message.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant