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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#import "SentrySDKWrapper.h"
#import <OCMock/OCMock.h>
#import <RNSentry/RNSentry.h>
#import <Sentry/PrivateSentrySDKOnly.h>
#import <Sentry/SentryProfilingConditionals.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@import RNSentry.Swift;
@import Sentry;

@interface RNSentryInitNativeSdkTests : XCTestCase
Expand Down Expand Up @@ -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(
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ios/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
25 changes: 2 additions & 23 deletions packages/core/ios/RNSentryInternal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}
Expand All @@ -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 }
Expand Down
5 changes: 3 additions & 2 deletions samples/react-native/ios/SentryNativeInitializer.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "SentryNativeInitializer.h"
@import RNSentry.Swift;
@import Sentry;

@implementation SentryNativeInitializer
Expand Down Expand Up @@ -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
}];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#import "SentryNativeInitializer.h"
#import <RNSentry/RNSentry.h>
#import <Sentry/PrivateSentrySDKOnly.h>
#import <Sentry/Sentry.h>

@interface AppDelegate () <UNUserNotificationCenterDelegate> {
Expand Down
Loading