Skip to content

Commit

Permalink
Merge 4866d54 into 89f5186
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored Jul 3, 2024
2 parents 89f5186 + 4866d54 commit b429d2c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ sealed class ViewHierarchyNode(
(parent?.elevation ?: 0f) + view.elevation,
distance = distance,
parent = parent,
shouldRedact = false,
shouldRedact = options.experimental.sessionReplay.redactClasses.contains(view.javaClass.canonicalName),
isImportantForContentCapture = false, /* will be set by children */
isVisible = isVisible,
visibleRect = visibleRect
Expand Down
2 changes: 2 additions & 0 deletions sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -2705,6 +2705,7 @@ public final class io/sentry/SentryReplayOptions {
public fun getQuality ()Lio/sentry/SentryReplayOptions$SentryReplayQuality;
public fun getRedactAllImages ()Z
public fun getRedactAllText ()Z
public fun getRedactClasses ()Ljava/util/Set;
public fun getSessionDuration ()J
public fun getSessionSampleRate ()Ljava/lang/Double;
public fun getSessionSegmentDuration ()J
Expand All @@ -2714,6 +2715,7 @@ public final class io/sentry/SentryReplayOptions {
public fun setQuality (Lio/sentry/SentryReplayOptions$SentryReplayQuality;)V
public fun setRedactAllImages (Z)V
public fun setRedactAllText (Z)V
public fun setRedactClasses (Ljava/util/Set;)V
public fun setSessionSampleRate (Ljava/lang/Double;)V
}

Expand Down
18 changes: 18 additions & 0 deletions sentry/src/main/java/io/sentry/SentryReplayOptions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.sentry;

import io.sentry.util.SampleRateUtils;
import java.util.HashSet;
import java.util.Set;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -64,6 +66,14 @@ public enum SentryReplayQuality {
*/
private boolean redactAllImages = true;

/**
* Redact all views with the specified class names. The class name is the fully qualified class
* name of the view, e.g. android.widget.TextView.
*
* <p>Default is empty.
*/
private Set<String> redactClasses = new HashSet<>();

/**
* Defines the quality of the session replay. The higher the quality, the more accurate the replay
* will be, but also more data to transfer and more CPU load, defaults to MEDIUM.
Expand Down Expand Up @@ -147,6 +157,14 @@ public void setRedactAllImages(final boolean redactAllImages) {
this.redactAllImages = redactAllImages;
}

public Set<String> getRedactClasses() {
return this.redactClasses;
}

public void setRedactClasses(final Set<String> redactClasses) {
this.redactClasses = redactClasses;
}

@ApiStatus.Internal
public @NotNull SentryReplayQuality getQuality() {
return quality;
Expand Down

0 comments on commit b429d2c

Please sign in to comment.