From 65c9624ff385d437c966f06b49f66263aa000410 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 30 Oct 2024 09:58:42 +0100 Subject: [PATCH 1/2] chore: mask android jetpack compose --- .../_snippets/android-installation.mdx | 1 - .../_snippets/android-privacy.mdx | 23 ++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/contents/docs/session-replay/_snippets/android-installation.mdx b/contents/docs/session-replay/_snippets/android-installation.mdx index d78b0a19f674..dd5c7640e4d6 100644 --- a/contents/docs/session-replay/_snippets/android-installation.mdx +++ b/contents/docs/session-replay/_snippets/android-installation.mdx @@ -45,7 +45,6 @@ val config = PostHogAndroidConfig(apiKey = "").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. diff --git a/contents/docs/session-replay/_snippets/android-privacy.mdx b/contents/docs/session-replay/_snippets/android-privacy.mdx index 6bc3a4cd1ae1..e99370deb14a 100644 --- a/contents/docs/session-replay/_snippets/android-privacy.mdx +++ b/contents/docs/session-replay/_snippets/android-privacy.mdx @@ -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 @@ -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" /> -``` \ No newline at end of file +``` + +### Masking in Jetpack Compose + +- You can manually mark a Compose View for masking using the `postHogMask()` view modifier: + +```kotlin +... + Text( + text = AnnotatedString(text), + modifier = + modifier + .wrapContentSize() + .postHogMask() + .clickable { + text = "Clicked!" + }, + ) +... +``` From 9c72bde6dd618c0ef6aab04b45e7dd3557540a2d Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 30 Oct 2024 10:01:10 +0100 Subject: [PATCH 2/2] fix --- contents/docs/session-replay/_snippets/android-installation.mdx | 2 -- contents/docs/session-replay/_snippets/android-privacy.mdx | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/contents/docs/session-replay/_snippets/android-installation.mdx b/contents/docs/session-replay/_snippets/android-installation.mdx index dd5c7640e4d6..7c3ff0531368 100644 --- a/contents/docs/session-replay/_snippets/android-installation.mdx +++ b/contents/docs/session-replay/_snippets/android-installation.mdx @@ -19,12 +19,10 @@ val config = PostHogAndroidConfig(apiKey = "").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. diff --git a/contents/docs/session-replay/_snippets/android-privacy.mdx b/contents/docs/session-replay/_snippets/android-privacy.mdx index e99370deb14a..8c2bd6ba0a2b 100644 --- a/contents/docs/session-replay/_snippets/android-privacy.mdx +++ b/contents/docs/session-replay/_snippets/android-privacy.mdx @@ -13,7 +13,7 @@ To replace any type of `View` with a redacted version in the recording, set the - You can manually mark a Compose View for masking using the `postHogMask()` view modifier: -```kotlin +```android_kotlin ... Text( text = AnnotatedString(text),