feat(surveys): add optional intro screen before the first question - #515
Conversation
|
Reviews (1): Last reviewed commit: "feat(surveys): add optional intro screen..." | Re-trigger Greptile |
posthog-flutter Compliance ReportDate: 2026-08-30 22:40:33 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
|
moving to draft until we hear from @PostHog/team-surveys |
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
2229a6b to
13b3eee
Compare
|
Reviews (2): Last reviewed commit: "fix(surveys): skip the intro screen when..." | Re-trigger Greptile |
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
Adds the leading mirror of the confirmation message: an optional intro screen shown before question 1, configured via the new displayIntroScreen / introScreenHeader / introScreenDescription / introScreenDescriptionContentType / introScreenButtonText appearance fields. Rendered by the Dart survey UI; the native bridges forward the new fields (requires posthog-ios >= 3.70.0 and posthog-android >= 3.59.0). Advancing past it records no response and sends no survey event. Generated-By: PostHog Code Task-Id: 50ceca51-4b90-4b94-8e72-e01bce50073c
Parity with the web renderer: the intro has no default header, so an intro with neither header nor description would draw an empty sheet with a lone button. Skips straight to question 1 instead. Generated-By: PostHog Code Task-Id: 50ceca51-4b90-4b94-8e72-e01bce50073c
The sheet now draws its close affordance with the custom-painted SurveyIcon rather than a Material Icons glyph, so find.byIcon no longer matches. Locate the button by IconButton, matching the existing survey tests. Generated-By: PostHog Desktop Task-Id: de8974e0-537f-4189-a799-66a7bc98cb10
dac7644 to
fa8c6b4
Compare
the podspec was bumped to >= 3.70.0 for the intro screen appearance fields but Package.swift still allowed 3.69.x, so the spm build resolved an older posthog-ios and failed to compile PostHogDisplaySurvey+Dict.swift against the missing displayIntroScreen, introScreenHeader, introScreenDescription, introScreenDescriptionContentType and introScreenButtonText members. Generated-By: PostHog Desktop Task-Id: e5eeb291-dc63-454b-8b53-384816ef6f78
💡 Motivation and Context
Surveys can show a confirmation ("thank you") screen after the last question, but there is no equivalent screen before the first one.
This is the posthog-flutter part of the cross-SDK intro screen rollout tracked in PostHog/posthog#74064. The web/RN renderer shipped in PostHog/posthog-js#4436, and the native SDK parts are in PostHog/posthog-ios#754 and PostHog/posthog-android#677.
What it does:
PostHogDisplaySurveyAppearance/ resolved inSurveyAppearance:displayIntroScreen,introScreenHeader,introScreenDescription,introScreenDescriptionContentType,introScreenButtonText(button defaults to "Get started").IntroMessagewidget, the leading mirror ofConfirmationMessage, shown bySurveyBottomSheetbefore the first question whendisplayIntroScreenis on. The description follows the existing text-only rendering rule.onResponsecall, no method-channelsurveyAction, so no survey event. The X button keeps closing the survey with the normal dismissed event, and the confirmation branch still wins for completed surveys.PostHogDisplaySurvey+Dict.swift,PostHogDisplaySurveyExt.kt) forward the five new keys, since the appearance maps are hand-enumerated.PostHog >= 3.70.0andcom.posthog:posthog-android:[3.59.0,4.0.0)— please confirm the exact Android artifact version once its release ships (the changesets cascade may produce a different number). CI stays red until both are published; the Dart-only changes are green-path.💚 How did you test it?
Unit and widget tests added:
surveys_test.dart:fromDictparses the five intro keys (including the int-coded content type) and defaults to disabled when absent.survey_bottom_sheet_test.dart(new): presents the sheet viashowModalBottomSheetlikeSurveyServicedoes, and asserts the intro shows before question 1, advancing fires noonResponse/onClosedcallback, the off-flag skips the intro, and closing from the intro still notifiesonClosed.Written on Linux without a Flutter toolchain, so the suite was not executed locally — please rely on CI (
flutter test,dart analyze, format checks).📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file (.changeset/survey-intro-screen.md, minor)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
late boolstate field on_SurveyBottomSheetStateinitialized from the appearance; its "Get started" handler is a puresetState, deliberately not routed throughonResponse/_handleCloseso no method-channel call (and therefore no event) can occur on the advance path.Created with PostHog Code