Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Resumes replay when the app becomes active (#4303)
- Session replay redact view with transformation (#4308)
- Correct redact UIView with higher zPosition (#4309)

## 8.36.0

Expand Down
2 changes: 1 addition & 1 deletion Sources/Swift/Tools/UIRedactBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class UIRedactBuilder {
}

if !ignore {
for subview in view.subviews {
for subview in view.subviews.sorted(by: { $0.layer.zPosition < $1.layer.zPosition }) {
mapRedactRegion(fromView: subview, to: to, redacting: &redacting, area: area, redactText: redactText, redactImage: redactImage, transform: newTransform)
}
}
Expand Down
14 changes: 14 additions & 0 deletions Tests/SentryTests/SentryViewPhotographerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ class SentryViewPhotographerTests: XCTestCase {
assertColor(pixel, .green)
}

func testLabelRedactedWithHigherZpotition() throws {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
label.text = "Test"
label.layer.zPosition = 1

let viewOnTop = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
viewOnTop.backgroundColor = .green

let image = try XCTUnwrap(prepare(views: [label, viewOnTop]))
let pixel = color(at: CGPoint(x: 10, y: 10), in: image)

assertColor(pixel, .black)
}

func testLabelRedactedWithNonOpaqueViewOnTop() throws {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
label.text = "Test"
Expand Down