Skip to content

Conversation

@ioannisj
Copy link
Collaborator

@ioannisj ioannisj commented Jan 24, 2026

💡 Motivation and Context

Closes #351

Adds the ability to enable/disable session replay plugins via PostHog project settings.

The current configs options affected are

  • sessionReplayConfig.captureLogs (key sessionRecording.consoleLogRecordingEnabled)
  • sessionReplayConfig.captureNetworkTelemetry (key capturePerformance)

Local config takes precedence. A plugin must first be enabled locally before remote config is evaluated.

Local Config Remote Config Result
false true Disabled (disabling locally takes precedence)
false false Disabled (disabling locally takes precedence)
true true Enabled (local and remote match)
true false Disabled (enabled locally but remotely disabled)

Limitations / Future work

  • Only works when config.remoteConfig = true.
    • Future improvements could read and cache remote config from /flags?config=true response as a fallback when config.remoteConfig = false

💚 How did you test it?

  • Unit tests and manual testing

📝 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.

///
/// // Token automatically unsubscribes when deallocated
/// ```
final class MulticastCallback<T> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a generalized pattern already used in the codebase. Did not refactor existing code to keep the scope small for this PR, but will do with a future PR

@ioannisj ioannisj marked this pull request as ready for review January 27, 2026 18:18
@ioannisj ioannisj requested a review from a team as a code owner January 27, 2026 18:18
if let isEnabled = capturePerformanceValue as? Bool {
return isEnabled
}
// When enabled, capturePerformance is an object (we ignore the keys for now)
Copy link
Member

Choose a reason for hiding this comment

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

which configs are within the capturePerformance config?


if let index = installedIndex, !isEnabled {
// Installed, but disabled in remote
installedPlugins[index].stop()
Copy link
Member

Choose a reason for hiding this comment

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

Should we check that installedPlugins has the index (index) and the same for remove to avoid out-of-bounds issues?

///
/// // Token automatically unsubscribes when deallocated
/// ```
final class MulticastCallback<T> {
Copy link
Member

Choose a reason for hiding this comment

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

should we call it PostHogMulticastCallback to avoid naming clashes with other things?

let config = URLSessionConfiguration.default

#if DEBUG
config.requestCachePolicy = .reloadIgnoringLocalCacheData
Copy link
Member

Choose a reason for hiding this comment

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

whats that used for?

Copy link
Member

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

left a few comments but LGTM
the project settings FE would require a few changes since this is now supported on the ios sdk now, and most likely indirectly for rn ios and flutter ios

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.

Respect consoleLogRecordingEnabled remote config

3 participants