Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -11,6 +11,7 @@
### Fixes

- Enable native logs on Android when `enableLogs` is set ([#6967](https://github.com/getsentry/sentry-react-native/pull/6967))
- Honor `<Sentry.Mask>` in iOS error screenshots ([#6974](https://github.com/getsentry/sentry-react-native/pull/6974))

## 8.33.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,44 @@ final class RNSentryStartTests: XCTestCase {
XCTAssertTrue(actualOptions.screenshot.maskAllImages)
}

func testScreenshotMasksSentryMaskComponent() throws {
try startFromRN(options: [
"dsn": "https://abcd@efgh.ingest.sentry.io/123456",
"attachScreenshot": true,
"screenshot": [
"maskAllText": false,
"maskAllImages": false
]
])

let maskedViewClasses = SentrySDK.internal.options.screenshot.maskedViewClasses
XCTAssertTrue(maskedViewClasses.contains { $0 == RNSentryReplay.getMaskClass() })
}

func testScreenshotMasksSentryMaskComponentWithoutScreenshotOptions() throws {
try startFromRN(options: [
"dsn": "https://abcd@efgh.ingest.sentry.io/123456",
"attachScreenshot": true
])

let maskedViewClasses = SentrySDK.internal.options.screenshot.maskedViewClasses
XCTAssertTrue(maskedViewClasses.contains { $0 == RNSentryReplay.getMaskClass() })
}

func testScreenshotKeepsUserMaskedViewClassesWithSentryMaskComponent() throws {
try startFromRN(options: [
"dsn": "https://abcd@efgh.ingest.sentry.io/123456",
"attachScreenshot": true,
"screenshot": [
"maskedViewClasses": ["UILabel"]
]
])

let maskedViewClasses = SentrySDK.internal.options.screenshot.maskedViewClasses
XCTAssertTrue(maskedViewClasses.contains { $0 == UILabel.self })
XCTAssertTrue(maskedViewClasses.contains { $0 == RNSentryReplay.getMaskClass() })
}

func testMemoryIntrospectionOption() throws {
try startFromRN(options: [
"dsn": "https://abcd@efgh.ingest.sentry.io/123456",
Expand Down
12 changes: 12 additions & 0 deletions packages/core/ios/RNSentryStart.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ + (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
sentryOptions.screenshot.unmaskedViewClasses = classes;
}
}

// Honor <Sentry.Mask> in error screenshots, the same as in Session Replay. The native SDK only
// lets hybrid SDKs set the mask container class on the replay photographer, so register it as
// a masked view class instead: the wrapper's whole frame is masked, covering its children.
// <Sentry.Unmask> needs a container class (children are unmasked), which isn't available yet.
# if SENTRY_TARGET_REPLAY_SUPPORTED
Class maskClass = [RNSentryReplay getMaskClass];
if (![sentryOptions.screenshot.maskedViewClasses containsObject:maskClass]) {
sentryOptions.screenshot.maskedViewClasses =
[sentryOptions.screenshot.maskedViewClasses arrayByAddingObject:maskClass];
}
Comment thread
sentry-warden[bot] marked this conversation as resolved.
Resolved
# endif
#endif

// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
Expand Down
Loading