Skip to content

feat(surveys): add optional intro screen before the first question - #515

Open
jakesciotto wants to merge 2 commits into
mainfrom
posthog-code/survey-intro-screen
Open

feat(surveys): add optional intro screen before the first question#515
jakesciotto wants to merge 2 commits into
mainfrom
posthog-code/survey-intro-screen

Conversation

@jakesciotto

Copy link
Copy Markdown

💡 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:

  • New appearance fields parsed from the native payload and exposed on PostHogDisplaySurveyAppearance / resolved in SurveyAppearance: displayIntroScreen, introScreenHeader, introScreenDescription, introScreenDescriptionContentType, introScreenButtonText (button defaults to "Get started").
  • New IntroMessage widget, the leading mirror of ConfirmationMessage, shown by SurveyBottomSheet before the first question when displayIntroScreen is on. The description follows the existing text-only rendering rule.
  • Advancing past the intro flips local widget state only: no onResponse call, no method-channel surveyAction, 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.
  • Both native bridges (PostHogDisplaySurvey+Dict.swift, PostHogDisplaySurveyExt.kt) forward the five new keys, since the appearance maps are hand-enumerated.

⚠️ Blocked on native SDK releases. The bridge code reads the new fields from the native display models, so this PR needs posthog-ios >= 3.70.0 (PostHog/posthog-ios#754) and a posthog-android release containing PostHog/posthog-android#677. The dependency floors are bumped to PostHog >= 3.70.0 and com.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: fromDict parses 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 via showModalBottomSheet like SurveyService does, and asserts the intro shows before question 1, advancing fires no onResponse/onClosed callback, the off-flag skips the intro, and closing from the intro still notifies onClosed.

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

  • 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 changeset to generate a changeset file (.changeset/survey-intro-screen.md, minor)

🤖 Agent context

Autonomy: Human-driven (agent-assisted)


Created with PostHog Code

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
@jakesciotto jakesciotto self-assigned this Aug 6, 2026
@jakesciotto
jakesciotto marked this pull request as ready for review August 6, 2026 18:51
@jakesciotto
jakesciotto requested a review from a team as a code owner August 6, 2026 18:51
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "feat(surveys): add optional intro screen..." | Re-trigger Greptile

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
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-08-06 22:50:14 UTC
Duration: 96789ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 142ms
Format Validation.Event Has Uuid 116ms
Format Validation.Event Has Lib Properties 116ms
Format Validation.Distinct Id Is String 114ms
Format Validation.Token Is Present 114ms
Format Validation.Custom Properties Preserved 116ms
Format Validation.Event Has Timestamp 117ms
Retry Behavior.Retries On 503 5330ms
Retry Behavior.Does Not Retry On 400 2118ms
Retry Behavior.Does Not Retry On 401 2117ms
Retry Behavior.Respects Retry After Header 8126ms
Retry Behavior.Implements Backoff 15442ms
Retry Behavior.Retries On 500 5224ms
Retry Behavior.Retries On 502 5221ms
Retry Behavior.Retries On 504 5224ms
Retry Behavior.Max Retries Respected 15441ms
Deduplication.Generates Unique Uuids 124ms
Deduplication.Preserves Uuid On Retry 5222ms
Deduplication.Preserves Uuid And Timestamp On Retry 10324ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5229ms
Deduplication.No Duplicate Events In Batch 124ms
Deduplication.Different Events Have Different Uuids 115ms
Compression.Sends Gzip When Enabled 115ms
Batch Format.Uses Proper Batch Structure 112ms
Batch Format.Flush With No Events Sends Nothing 108ms
Batch Format.Multiple Events Batched Together 123ms
Error Handling.Does Not Retry On 403 2115ms
Error Handling.Does Not Retry On 413 2117ms
Error Handling.Retries On 408 5219ms

Feature_Flags Tests

16/16 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 12ms
Request Payload.Flags Request Uses V2 Query Param 10ms
Request Payload.Flags Request Hits Flags Path Not Decide 9ms
Request Payload.Flags Request Omits Authorization Header 10ms
Request Payload.Token In Flags Body Matches Init 9ms
Request Payload.Groups Round Trip 10ms
Request Payload.Groups Default To Empty Object 9ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 9ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 9ms
Request Payload.Disable Geoip Omitted Defaults To False 9ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 11ms
Request Lifecycle.No Flags Request On Init Alone 4ms
Request Lifecycle.No Flags Request On Normal Capture 112ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 15ms
Request Lifecycle.Mock Response Value Is Returned To Caller 9ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 115ms

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