Skip to content

chore(ios): use projectToken initializer for native config - #87

Merged
turnipdabeets merged 1 commit into
mainfrom
chore/ios-use-project-token-init
Sep 30, 2026
Merged

turnipdabeets merged 1 commit into
mainfrom
chore/ios-use-project-token-init

Conversation

@turnipdabeets

Copy link
Copy Markdown
Collaborator

💡 Motivation and Context

posthog-ios 4.0 (PostHog/posthog-ios#873) removes the deprecated PostHogConfig(apiKey:) / PostHogConfig(apiKey:host:) initializers. The iOS target was still building its native config through apiKey:host:, so it would stop compiling once the posthog-ios dependency moves to 4.x.

This swaps that one call to the equivalent init(projectToken:host:), which has existed since posthog-ios 3.56.0 (we pin 3.64.1). The old initializer just forwarded to this one, so behaviour is unchanged.

Not changed: posthog-kmp's own public PostHogConfig.apiKey parameter, the posthog-ios version, and every non-iOS target. I also checked the Apple source sets for the other APIs removed in 4.0 (native apiKey property, propertiesSanitizer, evaluationEnvironments, remoteConfig, getFeatureFlagPayload, replay debouncerDelay / maskPhotoLibraryImages) and found no other uses.

💚 How did you test it?

  • ./gradlew :posthog-kmp:compileKotlinIosArm64 :posthog-kmp:iosSimulatorArm64Test passes
  • ./gradlew detekt passes
  • Built sample/iosApp through Xcode and ran it on an iOS Simulator only (iPhone 17). A physical iPhone was paired but locked, so no on-device run was done.
    • With temporary, uncommitted sample edits, the app called PostHog.setup with a dummy token and a host pointing at a local mock server, then captured one event and flushed.
    • The mock server received GET /array/<token>/config, POST /flags?v=2 and POST /batch, each carrying the configured token as api_key; the batch contained the captured event. SDK debug logs showed batch sent successfully.

📝 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)

  • Authored with Claude Code (Opus 5.5) as a follow-up to the posthog-ios v4 deprecated-API removal.
  • No change intent: this is an internal call-site swap with no user-visible change, so it does not need a changelog entry or a release on its own.
  • No new test: existing iOS tests cover setup, and the change is a one-to-one initializer swap.

🤖 Generated with Claude Code

posthog-ios 4.0 removes the deprecated PostHogConfig(apiKey:host:) initializer.
Switch to the equivalent init(projectToken:host:), available since posthog-ios 3.56.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@turnipdabeets
turnipdabeets requested a review from a team as a code owner September 30, 2026 15:02
@turnipdabeets turnipdabeets self-assigned this Sep 30, 2026
@sampo-s-bot

sampo-s-bot Bot commented Sep 30, 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.

@turnipdabeets
turnipdabeets enabled auto-merge (squash) September 30, 2026 15:03
@turnipdabeets
turnipdabeets merged commit cf9a477 into main Sep 30, 2026
21 checks passed
@turnipdabeets
turnipdabeets deleted the chore/ios-use-project-token-init branch September 30, 2026 15:10
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.

2 participants