Skip to content

Commit b429d2c

Browse files
Merge 4866d54 into 89f5186
2 parents 89f5186 + 4866d54 commit b429d2c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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
@@ -2705,6 +2705,7 @@ public final class io/sentry/SentryReplayOptions {
27052705
public fun getQuality ()Lio/sentry/SentryReplayOptions$SentryReplayQuality;
27062706
public fun getRedactAllImages ()Z
27072707
public fun getRedactAllText ()Z
2708+
public fun getRedactClasses ()Ljava/util/Set;
27082709
public fun getSessionDuration ()J
27092710
public fun getSessionSampleRate ()Ljava/lang/Double;
27102711
public fun getSessionSegmentDuration ()J
@@ -2714,6 +2715,7 @@ public final class io/sentry/SentryReplayOptions {
27142715
public fun setQuality (Lio/sentry/SentryReplayOptions$SentryReplayQuality;)V
27152716
public fun setRedactAllImages (Z)V
27162717
public fun setRedactAllText (Z)V
2718+
public fun setRedactClasses (Ljava/util/Set;)V
27172719
public fun setSessionSampleRate (Ljava/lang/Double;)V
27182720
}
27192721

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)