diff --git a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryReplayOptionsTests.swift b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryReplayOptionsTests.swift index da7f1ccad1..054b7a13a2 100644 --- a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryReplayOptionsTests.swift +++ b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryReplayOptionsTests.swift @@ -64,7 +64,7 @@ final class RNSentryReplayOptions: XCTestCase { ] as NSDictionary).mutableCopy() as! NSMutableDictionary RNSentryReplay.updateOptions(optionsDict) - let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any]) + let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any]) XCTAssertEqual(actualOptions.sessionReplay.networkDetailAllowUrls.count, 1) XCTAssertEqual(actualOptions.sessionReplay.networkDetailDenyUrls.count, 1) @@ -84,7 +84,7 @@ final class RNSentryReplayOptions: XCTestCase { ] as NSDictionary).mutableCopy() as! NSMutableDictionary RNSentryReplay.updateOptions(optionsDict) - let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any]) + let actualOptions = try! SentrySDK.internal.options(fromDictionary: optionsDict as! [String: Any]) XCTAssertEqual(actualOptions.sessionReplay.networkDetailAllowUrls.count, 1) XCTAssertFalse(actualOptions.sessionReplay.networkCaptureBodies) diff --git a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m index 37f520b061..a5aa18533a 100644 --- a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m +++ b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m @@ -5,10 +5,10 @@ #import "SentrySDKWrapper.h" #import #import -#import #import #import #import +@import RNSentry.Swift; @import Sentry; @interface RNSentryInitNativeSdkTests : XCTestCase @@ -283,7 +283,7 @@ - (void)testStartWithDictionaryRemovesPerformanceProperties } ; [RNSentryStart startWithOptions:mockedReactNativeDictionary error:&error]; -SentryOptions *actualOptions = PrivateSentrySDKOnly.options; +SentryOptions *actualOptions = RNSentryInternal.options; XCTAssertNotNil(actualOptions, @"Did not create sentry options"); XCTAssertNil(error, @"Should not pass no error"); XCTAssertNotNil( @@ -303,7 +303,7 @@ - (void)testStartCaptureFailedRequestsIsDisabled @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", }; [RNSentryStart startWithOptions:mockedReactNativeDictionary error:&error]; - SentryOptions *actualOptions = PrivateSentrySDKOnly.options; + SentryOptions *actualOptions = RNSentryInternal.options; XCTAssertNotNil(actualOptions, @"Did not create sentry options"); XCTAssertNil(error, @"Should not pass no error"); @@ -638,7 +638,7 @@ - (void)testStartWithDictionaryInstallsConfigureProfilingFromExperimentsProfilin }, }; [RNSentryStart startWithOptions:mockedReactNativeDictionary error:&error]; - SentryOptions *actualOptions = PrivateSentrySDKOnly.options; + SentryOptions *actualOptions = RNSentryInternal.options; XCTAssertNotNil(actualOptions, @"Did not create sentry options"); XCTAssertNil(error, @"Should not pass no error"); diff --git a/packages/core/ios/AGENTS.md b/packages/core/ios/AGENTS.md index 04edda1bad..99498c23db 100644 --- a/packages/core/ios/AGENTS.md +++ b/packages/core/ios/AGENTS.md @@ -66,5 +66,5 @@ through a Swift bridge in `RNSentryInternal.swift`. The bridge imports Sentry with `@_spi(Private)` because several sub-APIs (`performance.currentScreenFrames`, `replay.configure`, `envelope.{store,capture,deserialize}`) are SPI-gated. `.m`/`.mm` callers import the auto-generated `RNSentry-Swift.h` and route -through `[RNSentryInternal …]` instead of touching `PrivateSentrySDKOnly` -(deprecated since cocoa 9.19.0 and slated for removal in the next major). +through `[RNSentryInternal …]` instead of accessing sentry-cocoa internals +directly. diff --git a/packages/core/ios/RNSentryInternal.swift b/packages/core/ios/RNSentryInternal.swift index 6fdfd4b810..7667c1372e 100644 --- a/packages/core/ios/RNSentryInternal.swift +++ b/packages/core/ios/RNSentryInternal.swift @@ -100,7 +100,7 @@ import Foundation // Accepts `Data?` (nil-safe) rather than `Data` so the ObjC bridge boundary // doesn't force-unwrap a nil `NSData*` from a failed base64 decode — that // would crash before we ever get a chance to check the result. Matches the - // nil-tolerant behaviour of the deprecated `PrivateSentrySDKOnly.envelopeWithData:`. + // nil-tolerant behavior of the previous Objective-C envelope API. @_spi(Private) @objc public static func envelope(fromData data: Data?) -> SentryEnvelope? { guard let data = data else { return nil } return SentrySDK.internal.envelope.deserialize(from: data) @@ -116,16 +116,7 @@ import Foundation // MARK: - Screenshot / view hierarchy / screen - // sentry-cocoa's `SentryInternalScreen/Screenshot/ViewHierarchyApi` are all - // gated to `(os(iOS) || os(tvOS)) && !SENTRY_NO_UI_FRAMEWORK`. On visionOS - // the new hybrid-SDK surface is intentionally absent, but the same - // functionality still lives on `PrivateSentrySDKOnly` (gated by - // `SENTRY_HAS_UIKIT`, which covers visionOS). Route the visionOS bridge - // through the deprecated SPI so we preserve pre-migration behaviour and - // keep this PR non-breaking. Remove the fallback once sentry-cocoa - // exposes these APIs on visionOS in the hybrid surface — or once cocoa - // drops `PrivateSentrySDKOnly` in a future major and forces our hand. - #if os(iOS) || os(tvOS) + #if os(iOS) || os(tvOS) || os(visionOS) @_spi(Private) @objc public static var captureScreenshots: [Data]? { SentrySDK.internal.screenshot.capture() } @@ -137,18 +128,6 @@ import Foundation @_spi(Private) @objc public static func setCurrentScreen(_ screenName: String?) { SentrySDK.internal.screen.setCurrent(screenName) } - #elseif os(visionOS) - @_spi(Private) @objc public static var captureScreenshots: [Data]? { - PrivateSentrySDKOnly.captureScreenshots() - } - - @_spi(Private) @objc public static var captureViewHierarchy: Data? { - PrivateSentrySDKOnly.captureViewHierarchy() - } - - @_spi(Private) @objc public static func setCurrentScreen(_ screenName: String?) { - PrivateSentrySDKOnly.setCurrentScreen(screenName) - } #else @_spi(Private) @objc public static var captureScreenshots: [Data]? { nil } @_spi(Private) @objc public static var captureViewHierarchy: Data? { nil } diff --git a/samples/react-native/ios/SentryNativeInitializer.m b/samples/react-native/ios/SentryNativeInitializer.m index 3a68b07574..4d2a9dd786 100644 --- a/samples/react-native/ios/SentryNativeInitializer.m +++ b/samples/react-native/ios/SentryNativeInitializer.m @@ -1,4 +1,5 @@ #import "SentryNativeInitializer.h" +@import RNSentry.Swift; @import Sentry; @implementation SentryNativeInitializer @@ -27,9 +28,9 @@ + (void)initializeSentry // Enable the App start and Frames tracking measurements // If this is disabled the app start and frames tracking // won't be passed from native to JS transactions - PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = true; + RNSentryInternal.appStartMeasurementHybridSDKMode = true; #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST - PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = true; + RNSentryInternal.framesTrackingMeasurementHybridSDKMode = true; #endif }]; } diff --git a/samples/react-native/ios/sentryreactnativesample/AppDelegate.mm b/samples/react-native/ios/sentryreactnativesample/AppDelegate.mm index 616456ca75..b0fdf8ea61 100644 --- a/samples/react-native/ios/sentryreactnativesample/AppDelegate.mm +++ b/samples/react-native/ios/sentryreactnativesample/AppDelegate.mm @@ -15,7 +15,6 @@ #import "SentryNativeInitializer.h" #import -#import #import @interface AppDelegate () {