fix(posthog): read sessionReplayConfig from Capacitor config on Android#816
Open
ciceroapps93 wants to merge 4 commits intocapawesome-team:mainfrom
Open
fix(posthog): read sessionReplayConfig from Capacitor config on Android#816ciceroapps93 wants to merge 4 commits intocapawesome-team:mainfrom
ciceroapps93 wants to merge 4 commits intocapawesome-team:mainfrom
Conversation
The `getPosthogConfig()` method on Android does not read the `sessionReplayConfig` object from the Capacitor plugin configuration, causing session replay masking options (maskAllTextInputs, maskAllImages, etc.) to be silently ignored during auto-initialization. The iOS implementation already reads this config correctly in `posthogConfig()`. This adds the missing `sessionReplayConfig` parsing to the Android `getPosthogConfig()` method, matching the existing behavior in: - iOS `PosthogPlugin.swift` `posthogConfig()` method - Android `setup()` PluginMethod (JS-callable path)
robingenz
requested changes
Apr 1, 2026
Member
robingenz
left a comment
There was a problem hiding this comment.
Please run npm run changeset to geenrate a changeset file.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Android auto-initialization for the Posthog Capacitor plugin so that sessionReplayConfig from capacitor.config.* is actually parsed and applied (matching iOS behavior and the Android setup() method).
Changes:
- Parse
sessionReplayConfiginside AndroidgetPosthogConfig()and map it intoSessionReplayOptions. - Add the required JSON import for reading nested config values.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Please also check out the GitHub Copilot review. |
…js/plugins/posthog/PosthogPlugin.java - align with documentation defaults Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
robingenz
reviewed
Apr 9, 2026
robingenz
requested changes
Apr 9, 2026
Member
robingenz
left a comment
There was a problem hiding this comment.
Please run npm run fmt to fix the formatting issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
getPosthogConfig()method on Android does not read thesessionReplayConfigobject from the Capacitor plugin configuration, causing session replay masking options (maskAllTextInputs,maskAllImages,maskAllSandboxedViews,screenshotMode,captureNetworkTelemetry,debouncerDelay) to be silently ignored during auto-initialization fromcapacitor.config.ts.The iOS implementation already reads this config correctly in
posthogConfig()(PosthogPlugin.swift L257-L266), and the Androidsetup()PluginMethod (JS-callable path) also handles it correctly (PosthogPlugin.java L298-L309). Only the Android auto-init path is missing it.Reproduction
Configure
sessionReplayConfigincapacitor.config.ts:On iOS, masking is disabled as expected. On Android, all content remains masked because
sessionReplayConfigis never read from the config.Fix
Adds the missing
sessionReplayConfigparsing togetPosthogConfig(), matching the existing iOS implementation and the Androidsetup()method.