Skip to content

Commit 7bd8d98

Browse files
Merge bc18c8b into a54f92f
2 parents a54f92f + bc18c8b commit 7bd8d98

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-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/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)