Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: mask android jetpack compose #9760

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ val config = PostHogAndroidConfig(apiKey = "<ph_project_api_key>").apply {
sessionReplay = true

// Whether text inputs are masked. Default is true.
// This isn't supported for Jetpack Compose views.
// Password inputs are always masked regardless
sessionReplayConfig.maskAllTextInputs = true

// Whether images are masked. Default is true.
// This isn't supported for Jetpack Compose views.
sessionReplayConfig.maskAllImages = true

// Capture logs automatically. Default is true.
Expand All @@ -45,7 +43,6 @@ val config = PostHogAndroidConfig(apiKey = "<ph_project_api_key>").apply {

- Requires Android API >= 26.
- Jetpack Compose is only supported if `screenshotMode` is enabled.
- Masking and redacting in Jetpack Compose isn't supported yet. We're investigating this [issue](https://github.com/PostHog/posthog-android/issues/158).
- Custom views are partly supported, and only fully supported if `screenshotMode` is enabled.
- WebView is not supported. A placeholder will be shown.
- Keyboard is not supported. A placeholder will be shown.
Expand Down
23 changes: 20 additions & 3 deletions contents/docs/session-replay/_snippets/android-privacy.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
> 🚧 **NOTE:** Currently, this isn't supported if using Jetpack Compose views. We're investigating this [issue](https://github.com/PostHog/posthog-android/issues/158).

To replace any type of `View` with a redacted version in the recording, set the [tag](https://developer.android.com/reference/android/view/View#tags) to `ph-no-capture`.

```xml
Expand All @@ -9,4 +7,23 @@ To replace any type of `View` with a redacted version in the recording, set the
android:layout_height="200dp"
android:tag="ph-no-capture"
/>
```
```

### Masking in Jetpack Compose

- You can manually mark a Compose View for masking using the `postHogMask()` view modifier:

```android_kotlin
...
Text(
text = AnnotatedString(text),
modifier =
modifier
.wrapContentSize()
.postHogMask()
.clickable {
text = "Clicked!"
},
)
...
```
Loading