Repository navigation
feat: add surveys option to PostHogConfig - #125
Open
turnipdabeets wants to merge 1 commit into
Open
turnipdabeets wants to merge 1 commit into
turnipdabeets wants to merge 1 commit into
Conversation
Map it to config.surveys on iOS and Android and to disable_surveys on web, so apps and libraries can keep the SDK from loading or showing surveys. Defaults to true. Closes #124. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Closes #124.
Developers can't turn surveys off from KMP. posthog-ios has surveys on by default and shows popovers with its built-in UI, and posthog-js does the same on web. Libraries that embed posthog-kmp, like HDCharts' usage telemetry, need to rule out survey UI appearing in the apps that use them. HDCharts keeps iOS reporting off for this reason.
This adds
surveys: Boolean = truetoPostHogConfig:config.surveystrue)disable_surveys = !surveysconfig.surveysfalse. The surveys integration now loads. It shows surveys only if the app also depends onposthog-android-surveys-compose(documented beta). Otherwise the native default delegate only logs.For reviewers:
falseto keep the old behavior. If we'd rather not change Android, the alternative is to leave Android unwired for now.copysignatures, and every existingcopyoverload now passessurveysthrough. Without that,config.copy(debug = true)would resetsurveystotrue. Tests cover both cases.config.surveysbehind theSurveyspackage trait, which is on by default, so this mapping still compiles on 4.0.💚 How did you test it?
./gradlew allTestspassed: 462 tests, 0 failures, across JVM, Android host, JS (node and browser), Wasm, iOS simulator and macOS. That includes new tests for the default, forcopykeeping the value, for the Android and JS/Wasm mappings, and for Java callers of the previous signatures../gradlew detektpassed.📝 Checklist
If releasing new changes
pnpm changeto generate a change intent file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code. Before implementing, I compared the option across posthog-ios, posthog-android, posthog-js, React Native and Flutter, and checked posthog-ios 4.0. 4.0's
SurveysSwiftPM package trait was considered and rejected as the fix. Only posthog-kmp's own SwiftPM declaration can set the trait, so it would apply to every KMP user. And SwiftPM adds traits up across the dependency graph, so an app could switch it back on.🤖 Generated with Claude Code