Skip to content

feat(replay): allow disabling touches without stopping screenshots - #575

Merged
marandaneto merged 3 commits into
mainfrom
fix/570-replay-capture-touches
Sep 12, 2026
Merged

marandaneto merged 3 commits into
mainfrom
fix/570-replay-capture-touches

Conversation

@marandaneto

@marandaneto marandaneto commented Sep 11, 2026

Copy link
Copy Markdown
Member

💡 Motivation and Context

Closes #570.

Masking a PIN keypad hides its pixels but not its replay touch coordinates. A known keypad layout can therefore reveal the entered value.

Add sessionReplayConfig.captureTouches, enabled by default, to disable touch recording on Android and iOS while masked screenshots continue. Set it before Posthog().setup(config). Both native bridges forward the setting during initialization. There is no runtime toggle, and changing the Dart field after setup does not update native state.

The native changes are merged and released in iOS 3.74.0 and Android 3.64.0. These are the minimum versions required by this PR. Native implementation PRs: PostHog/posthog-ios#823 and PostHog/posthog-android#780.

💚 How did you test it?

  • Merged the latest main branch without conflicts. All 351 Flutter tests and all 36 Android bridge tests pass.
  • Disabled local native SDK overrides and verified resolution to published Android 3.64.0 and iOS 3.74.0 artifacts.
  • Built the Android release APK and web example. Built the iOS simulator and macOS examples with both CocoaPods and Swift Package Manager.
  • During implementation, separate Android emulator startups with touch capture enabled and disabled each received three keypad taps. Enabled capture sent six touch events and disabled capture sent zero. Each run sent four masked screenshots and kept replay active. This earlier runtime validation used local native builds of the changes that are now released.
  • Dart analysis, formatting, API snapshot checks, and committed-branch autoreview pass.

📝 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

  • Added a minor changeset file.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Pi implemented and tested the Flutter and native changes in separate worktrees using Flutter, Gradle, adb, XcodeBuildMCP, a local test server, and autoreview. The implementation follows the requested initialization-only configuration. The session transcript remains local. Human review is required.

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-09-12 06:20:41 UTC
Duration: 96733ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 137ms
Format Validation.Event Has Uuid 119ms
Format Validation.Event Has Lib Properties 113ms
Format Validation.Distinct Id Is String 114ms
Format Validation.Token Is Present 115ms
Format Validation.Custom Properties Preserved 116ms
Format Validation.Event Has Timestamp 116ms
Retry Behavior.Retries On 503 5330ms
Retry Behavior.Does Not Retry On 400 2117ms
Retry Behavior.Does Not Retry On 401 2116ms
Retry Behavior.Respects Retry After Header 8125ms
Retry Behavior.Implements Backoff 15446ms
Retry Behavior.Retries On 500 5223ms
Retry Behavior.Retries On 502 5225ms
Retry Behavior.Retries On 504 5219ms
Retry Behavior.Max Retries Respected 15444ms
Deduplication.Generates Unique Uuids 123ms
Deduplication.Preserves Uuid On Retry 5224ms
Deduplication.Preserves Uuid And Timestamp On Retry 10333ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5229ms
Deduplication.No Duplicate Events In Batch 121ms
Deduplication.Different Events Have Different Uuids 120ms
Compression.Sends Gzip When Enabled 116ms
Batch Format.Uses Proper Batch Structure 113ms
Batch Format.Flush With No Events Sends Nothing 108ms
Batch Format.Multiple Events Batched Together 120ms
Error Handling.Does Not Retry On 403 2116ms
Error Handling.Does Not Retry On 413 2117ms
Error Handling.Retries On 408 5223ms

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 8ms
Request Payload.Flags Request Hits Flags Path Not Decide 7ms
Request Payload.Flags Request Omits Authorization Header 8ms
Request Payload.Token In Flags Body Matches Init 8ms
Request Payload.Groups Round Trip 7ms
Request Payload.Groups Default To Empty Object 8ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 7ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 8ms
Request Payload.Disable Geoip Omitted Defaults To False 7ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 7ms
Request Lifecycle.No Flags Request On Init Alone 4ms
Request Lifecycle.No Flags Request On Normal Capture 110ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 14ms
Request Lifecycle.Mock Response Value Is Returned To Caller 8ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 112ms

@marandaneto

Copy link
Copy Markdown
Member Author

TODO: Add the same initialization-only captureTouches option to React Native after the native SDK changes are released. Default it to true and forward it during Android/iOS SDK setup so apps can disable replay touch coordinates while keeping screenshots. No runtime toggle.

@turnipdabeets turnipdabeets left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS and android need to release first, but approving to unblock.

@marandaneto
marandaneto marked this pull request as ready for review September 12, 2026 08:48
@marandaneto
marandaneto requested a review from a team as a code owner September 12, 2026 08:48
@greptile-apps

greptile-apps Bot commented Sep 12, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@marandaneto
marandaneto merged commit dddc307 into main Sep 12, 2026
28 of 29 checks passed
@marandaneto
marandaneto deleted the fix/570-replay-capture-touches branch September 12, 2026 08:53
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.

Session replay: add captureTouches flag — masking cannot protect keypad entry because tap coordinates leak the value

2 participants