Skip to content

Session Replay: Add support for multiple window setups #390

Open

Description

@ioannisj

Description

Ticket: https://posthoghelp.zendesk.com/agent/tickets/39754 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/44966)

The current session replay window detection logic has limitations when handling transparent (or passthrough) overlay windows, leading to incomplete or inaccurate screen captures and masking in certain use cases.

Current Implementation

Session replay uses [UIApplication.getCurrentWindow()](https://github.com/PostHog/posthog-ios/blob/b71b7b1ba861391377d01251479530b938881ce0/PostHog/Replay/PostHogReplayIntegration.swift#L237) which returns the top-most key window:

guard let window = UIApplication.getCurrentWindow() else {
    return
}

This approach does not explicitly handle cases where a custom overlay or passthrough window is added to the app. This technique is often used to manage and display app-wide notifications/toasts, bottom-sheets, modal alerts etc

Proposed Solution

Implement window stack detection that:

  • Discover all windows between the top transparent window down to the first opaque window
  • Filters system windows like UITextEffectsWindow
  • Capture a composite of UIWindow snapshots (+ masking) bottom-up this time around

Priority

There's a limited user report which suggests this isn't widely affecting users. Since the implementation will have wide implications on the current session replay implementation (for example there are some system window overlays like UITextEffectsWindow that should be ignored), I'm opening this issue to collect interest before before moving with a any implementation effort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions