Skip to content
Draft
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

## Unreleased

### Fixes

- Fix iOS screenshots no longer being captured since 8.19.0 (Feedback Widget screenshot, `attachScreenshot`, `Sentry.captureScreenshot()`) by reverting the iOS `SentrySDK.internal` migration from #6380 ([#6491](https://github.com/getsentry/sentry-react-native/pull/6491), [#6497](https://github.com/getsentry/sentry-react-native/issues/6497))

### Dependencies

- Bump JavaScript SDK from v10.65.0 to v10.67.0 ([#6471](https://github.com/getsentry/sentry-react-native/pull/6471), [#6494](https://github.com/getsentry/sentry-react-native/pull/6494))
Expand Down
21 changes: 1 addition & 20 deletions dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,8 @@ if (currentMatch) {
debug.log('Warning: Could not find platform :ios line to patch');
}

// RNSentry now contains Swift code (via the RNSentryInternal bridge over
// SentrySDK.internal). CocoaPods refuses to integrate a Swift pod against
// non-modular ObjC dependencies (e.g. React-hermes on older RN versions),
// so ensure the Podfile requests modular headers globally.
let modularPatched = false;
if (!content.includes('use_modular_headers!')) {
const patched = content.replace(
/prepare_react_native_project!\s*\n/,
"prepare_react_native_project!\nuse_modular_headers!\n",
);
if (patched !== content) {
content = patched;
modularPatched = true;
debug.log('Patching Podfile with use_modular_headers!');
} else {
debug.log('Warning: Could not find prepare_react_native_project! anchor to inject use_modular_headers!');
}
}

// Write the file if any changes were made
if (shouldPatch || currentMatch || modularPatched) {
if (shouldPatch || currentMatch) {
fs.writeFileSync(args['pod-file'], content);
debug.log('Podfile patched successfully!');
} else {
Expand Down
26 changes: 17 additions & 9 deletions packages/core/RNSentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,23 @@ Pod::Spec.new do |s|
# in `android/CMakeLists.txt`. The files are guarded with
# `RCT_NEW_ARCH_ENABLED` so they compile to empty TUs on Old Arch.
#
# Swift is compiled unconditionally because `RNSentryInternal.swift` is
# the sole ObjCโ†”Swift bridge over `SentrySDK.internal.*` โ€” every `.m`/
# `.mm` file in this pod calls into it. That makes RNSentry a Swift pod
# in CocoaPods' eyes, which in turn requires modular headers from its
# ObjC dependencies. Users on React Native < 0.75 (where `React-hermes`
# and friends aren't modularized by default) must add
# `use_modular_headers!` to their Podfile โ€” see CHANGELOG.
s.source_files = 'ios/**/*.{h,m,mm,swift}', 'cpp/**/*.{h,cpp}'
s.swift_versions = ['5.5']
# We include `.swift` (for `RNSentrySwiftLinkStub.swift`) only on RN >=
# 0.75. Adding a Swift file makes CocoaPods treat RNSentry as a Swift
# pod, which then requires modular headers from its ObjC dependencies
# (React-Core, React-hermes) โ€” RN < 0.75 doesn't emit those, so
# `pod install` fails with:
# "The Swift pod `RNSentry` depends upon `React-hermes`, which does
# not define modules."
# The stub is only needed when linking Sentry.xcframework's Swift
# symbols into a dynamic framework anyway (RN 0.86+ `use_frameworks!
# :dynamic`), so gating on RN 0.75 is safe.
supports_swift_stub = rn_version[:major] >= 1 || (rn_version[:major] == 0 && rn_version[:minor] >= 75)
if supports_swift_stub
s.source_files = 'ios/**/*.{h,m,mm,swift}', 'cpp/**/*.{h,cpp}'
s.swift_versions = ['5.5']
else
s.source_files = 'ios/**/*.{h,m,mm}', 'cpp/**/*.{h,cpp}'
end
s.public_header_files = 'ios/RNSentry.h', 'ios/RNSentrySDK.h', 'ios/RNSentryStart.h', 'ios/RNSentryVersion.h', 'ios/RNSentryBreadcrumb.h', 'ios/RNSentryReplay.h', 'ios/RNSentryReplayBreadcrumbConverter.h', 'ios/Replay/RNSentryReplayMask.h', 'ios/Replay/RNSentryReplayUnmask.h', 'ios/RNSentryTimeToDisplay.h'

s.compiler_flags = other_cflags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
2639D71D3BD04F17B0BAC987 /* RNSentryTurboModulePerfControllerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */; };
332D33472CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 332D33462CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift */; };
3339C4812D6625570088EB3A /* RNSentryUserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3339C4802D6625570088EB3A /* RNSentryUserTests.m */; };
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */; };
Expand All @@ -18,6 +17,7 @@
33DEDFED2D8DC825006066E4 /* RNSentryOnDrawReporter+Test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEC2D8DC820006066E4 /* RNSentryOnDrawReporter+Test.mm */; };
33DEDFF02D9185EB006066E4 /* RNSentryTimeToDisplayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEF2D9185E3006066E4 /* RNSentryTimeToDisplayTests.swift */; };
33F58AD02977037D008F60EA /* RNSentryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33F58ACF2977037D008F60EA /* RNSentryTests.m */; };
2639D71D3BD04F17B0BAC987 /* RNSentryTurboModulePerfControllerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */; };
AEFB00422CC90C4B00EC8A9A /* RNSentryBreadcrumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */; };
B4DEB41739F14AA38202D4D4 /* RNSentryUriValidationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3742693F7643C2ADE1BDF2 /* RNSentryUriValidationTests.m */; };
B5859A50A3E865EF5E61465A /* libPods-RNSentryCocoaTesterTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */; };
Expand Down Expand Up @@ -52,8 +52,8 @@
33F58ACF2977037D008F60EA /* RNSentryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSentryTests.m; sourceTree = "<group>"; };
3E3742693F7643C2ADE1BDF2 /* RNSentryUriValidationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryUriValidationTests.m; sourceTree = "<group>"; };
650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNSentryCocoaTesterTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E2321E7CFA55AB617247098E /* Pods-RNSentryCocoaTesterTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.debug.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.debug.xcconfig"; sourceTree = "<group>"; };
E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNSentryTurboModulePerfControllerTests.mm; sourceTree = "<group>"; };
E2321E7CFA55AB617247098E /* Pods-RNSentryCocoaTesterTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.debug.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.debug.xcconfig"; sourceTree = "<group>"; };
F48F26542EA2A481008A185E /* RNSentryEmitNewFrameEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryEmitNewFrameEvent.h; path = ../ios/RNSentryEmitNewFrameEvent.h; sourceTree = SOURCE_ROOT; };
F48F26552EA2A4D4008A185E /* RNSentryFramesTrackerListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryFramesTrackerListener.h; path = ../ios/RNSentryFramesTrackerListener.h; sourceTree = SOURCE_ROOT; };
FADF868E2EBD053E00D6652D /* SentrySDKWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySDKWrapper.h; path = ../ios/SentrySDKWrapper.h; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -169,7 +169,6 @@
3360898929524164007C7730 /* Sources */,
BB7D14838753E6599863899B /* Frameworks */,
CC7959F3721CB3AD7CB6A047 /* [CP] Copy Pods Resources */,
2AA6DCCDB9B6D20211E939EC /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -215,23 +214,6 @@
/* End PBXProject section */

/* Begin PBXShellScriptBuildPhase section */
2AA6DCCDB9B6D20211E939EC /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
30F19D4E16BEEFEC68733838 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -352,23 +334,14 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"$(inherited)",
"-DRCT_REMOVE_LEGACY_ARCH=1",
);
OTHER_CPLUSPLUSFLAGS = (
"$(inherited)",
"-DRCT_REMOVE_LEGACY_ARCH=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
PODFILE_DIR = "$(SRCROOT)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
USE_HERMES = true;
USE_HERMES = false;
};
name = Debug;
};
Expand Down Expand Up @@ -420,22 +393,13 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_CFLAGS = (
"$(inherited)",
"-DRCT_REMOVE_LEGACY_ARCH=1",
);
OTHER_CPLUSPLUSFLAGS = (
"$(inherited)",
"-DRCT_REMOVE_LEGACY_ARCH=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
PODFILE_DIR = "$(SRCROOT)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
USE_HERMES = false;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@_spi(Private) import Sentry
import Sentry
import XCTest

// File length grows as replay option coverage is added; lint runs with `--strict`.
Expand Down Expand Up @@ -117,7 +117,7 @@ final class RNSentryReplayOptions: XCTestCase {
] as NSDictionary).mutableCopy() as! NSMutableDictionary
RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])
XCTAssertEqual(actualOptions.sessionReplay.sessionSampleRate, 0.75)
}

Expand All @@ -128,7 +128,7 @@ final class RNSentryReplayOptions: XCTestCase {
] as NSDictionary).mutableCopy() as! NSMutableDictionary
RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])
XCTAssertEqual(actualOptions.sessionReplay.onErrorSampleRate, 0.75)
}

Expand Down Expand Up @@ -158,7 +158,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllImages, true)
assertContainsClass(classArray: actualOptions.sessionReplay.maskedViewClasses, stringClass: "RCTImageView")
Expand All @@ -173,7 +173,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllImages, false)
XCTAssertEqual(actualOptions.sessionReplay.maskedViewClasses.count, 0)
Expand All @@ -188,7 +188,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllText, true)
assertContainsClass(classArray: actualOptions.sessionReplay.maskedViewClasses, stringClass: "RCTTextView")
Expand All @@ -215,7 +215,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllText, false)
XCTAssertEqual(actualOptions.sessionReplay.maskedViewClasses.count, 0)
Expand All @@ -229,7 +229,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertTrue(actualOptions.sessionReplay.enableViewRendererV2)
}
Expand All @@ -243,7 +243,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertTrue(actualOptions.sessionReplay.enableViewRendererV2)
}
Expand All @@ -257,7 +257,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertFalse(actualOptions.sessionReplay.enableViewRendererV2)
}
Expand All @@ -270,7 +270,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertFalse(actualOptions.sessionReplay.enableFastViewRendering)
}
Expand All @@ -284,7 +284,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertTrue(actualOptions.sessionReplay.enableFastViewRendering)
}
Expand All @@ -298,7 +298,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertFalse(actualOptions.sessionReplay.enableFastViewRendering)
}
Expand All @@ -311,7 +311,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.medium)
}
Expand All @@ -325,7 +325,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.low)
}
Expand All @@ -339,7 +339,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.medium)
}
Expand All @@ -353,7 +353,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.high)
}
Expand All @@ -367,7 +367,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.medium)
}
Expand All @@ -381,7 +381,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

let includedViewClasses = actualOptions.sessionReplay.includedViewClasses
XCTAssertEqual(includedViewClasses.count, 3)
Expand All @@ -399,7 +399,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

let excludedViewClasses = actualOptions.sessionReplay.excludedViewClasses
XCTAssertEqual(excludedViewClasses.count, 3)
Expand All @@ -420,7 +420,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

let includedViewClasses = actualOptions.sessionReplay.includedViewClasses
XCTAssertEqual(includedViewClasses.count, 2)
Expand Down
Loading
Loading