Skip to content

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

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

feat(surveys): add optional intro screen before the first question#515
jakesciotto wants to merge 3 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

@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

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-08-19 22:05:19 UTC
Duration: 96322ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 123ms
Format Validation.Event Has Uuid 111ms
Format Validation.Event Has Lib Properties 109ms
Format Validation.Distinct Id Is String 108ms
Format Validation.Token Is Present 108ms
Format Validation.Custom Properties Preserved 109ms
Format Validation.Event Has Timestamp 109ms
Retry Behavior.Retries On 503 5317ms
Retry Behavior.Does Not Retry On 400 2110ms
Retry Behavior.Does Not Retry On 401 2110ms
Retry Behavior.Respects Retry After Header 8114ms
Retry Behavior.Implements Backoff 15430ms
Retry Behavior.Retries On 500 5217ms
Retry Behavior.Retries On 502 5215ms
Retry Behavior.Retries On 504 5214ms
Retry Behavior.Max Retries Respected 15430ms
Deduplication.Generates Unique Uuids 115ms
Deduplication.Preserves Uuid On Retry 5214ms
Deduplication.Preserves Uuid And Timestamp On Retry 10324ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5218ms
Deduplication.No Duplicate Events In Batch 112ms
Deduplication.Different Events Have Different Uuids 110ms
Compression.Sends Gzip When Enabled 108ms
Batch Format.Uses Proper Batch Structure 107ms
Batch Format.Flush With No Events Sends Nothing 105ms
Batch Format.Multiple Events Batched Together 113ms
Error Handling.Does Not Retry On 403 2109ms
Error Handling.Does Not Retry On 413 2109ms
Error Handling.Retries On 408 5210ms

Feature_Flags Tests

16/16 tests passed

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

@marandaneto
marandaneto requested a review from a team August 10, 2026 10:13
@marandaneto

Copy link
Copy Markdown
Member

moving to draft until we hear from @PostHog/team-surveys

@marandaneto
marandaneto marked this pull request as draft August 10, 2026 10:13
@github-actions

Copy link
Copy Markdown
Contributor

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 stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label Aug 18, 2026
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
@jakesciotto
jakesciotto force-pushed the posthog-code/survey-intro-screen branch from 2229a6b to 13b3eee Compare August 19, 2026 21:20
@jakesciotto
jakesciotto marked this pull request as ready for review August 19, 2026 21:42
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "fix(surveys): skip the intro screen when..." | Re-trigger Greptile

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
@github-actions github-actions Bot removed the stale label Aug 20, 2026
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