Skip to content

Commit 1ec4df3

Browse files
Merge 8f9a6d3 into a54f92f
2 parents a54f92f + 8f9a6d3 commit 1ec4df3

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Add `redactClasses` to Session Replay options ([#3546](https://github.com/getsentry/sentry-java/pull/3546))
8+
39
## 7.11.0-alpha.2
410

511
- Session Replay for Android ([#3339](https://github.com/getsentry/sentry-java/pull/3339))

sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ sealed class ViewHierarchyNode(
282282
(parent?.elevation ?: 0f) + view.elevation,
283283
distance = distance,
284284
parent = parent,
285-
shouldRedact = false,
285+
shouldRedact = options.experimental.sessionReplay.redactClasses.contains(view.javaClass.canonicalName),
286286
isImportantForContentCapture = false, /* will be set by children */
287287
isVisible = isVisible,
288288
visibleRect = visibleRect

sentry/api/sentry.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,7 @@ public final class io/sentry/SentryReplayOptions {
27012701
public fun getQuality ()Lio/sentry/SentryReplayOptions$SentryReplayQuality;
27022702
public fun getRedactAllImages ()Z
27032703
public fun getRedactAllText ()Z
2704+
public fun getRedactClasses ()Ljava/util/Set;
27042705
public fun getSessionDuration ()J
27052706
public fun getSessionSampleRate ()Ljava/lang/Double;
27062707
public fun getSessionSegmentDuration ()J
@@ -2710,6 +2711,7 @@ public final class io/sentry/SentryReplayOptions {
27102711
public fun setQuality (Lio/sentry/SentryReplayOptions$SentryReplayQuality;)V
27112712
public fun setRedactAllImages (Z)V
27122713
public fun setRedactAllText (Z)V
2714+
public fun setRedactClasses (Ljava/util/Set;)V
27132715
public fun setSessionSampleRate (Ljava/lang/Double;)V
27142716
}
27152717

sentry/src/main/java/io/sentry/SentryReplayOptions.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package io.sentry;
22

33
import io.sentry.util.SampleRateUtils;
4+
import java.util.HashSet;
5+
import java.util.Set;
46
import org.jetbrains.annotations.ApiStatus;
57
import org.jetbrains.annotations.NotNull;
68
import org.jetbrains.annotations.Nullable;
@@ -64,6 +66,14 @@ public enum SentryReplayQuality {
6466
*/
6567
private boolean redactAllImages = true;
6668

69+
/**
70+
* Redact all views with the specified class names. The class name is the fully qualified class
71+
* name of the view, e.g. android.widget.TextView.
72+
*
73+
* <p>Default is empty.
74+
*/
75+
private Set<String> redactClasses = new HashSet<>();
76+
6777
/**
6878
* Defines the quality of the session replay. The higher the quality, the more accurate the replay
6979
* will be, but also more data to transfer and more CPU load, defaults to MEDIUM.
@@ -147,6 +157,14 @@ public void setRedactAllImages(final boolean redactAllImages) {
147157
this.redactAllImages = redactAllImages;
148158
}
149159

160+
public Set<String> getRedactClasses() {
161+
return this.redactClasses;
162+
}
163+
164+
public void setRedactClasses(final Set<String> redactClasses) {
165+
this.redactClasses = redactClasses;
166+
}
167+
150168
@ApiStatus.Internal
151169
public @NotNull SentryReplayQuality getQuality() {
152170
return quality;

0 commit comments

Comments
 (0)