21
21
#import < Sentry/PrivateSentrySDKOnly.h>
22
22
#import < Sentry/SentryAppStartMeasurement.h>
23
23
#import < Sentry/SentryBinaryImageCache.h>
24
+ #import < Sentry/SentryBreadcrumb.h>
24
25
#import < Sentry/SentryDebugImageProvider+HybridSDKs.h>
26
+ #import < Sentry/SentryDebugMeta.h>
25
27
#import < Sentry/SentryDependencyContainer.h>
28
+ #import < Sentry/SentryEvent.h>
29
+ #import < Sentry/SentryException.h>
26
30
#import < Sentry/SentryFormatter.h>
31
+ #import < Sentry/SentryOptions.h>
32
+ #import < Sentry/SentryUser.h>
27
33
#if __has_include(<Sentry/SentryOptions+HybridSDKs.h>)
28
34
# define USE_SENTRY_OPTIONS 1
29
35
# import < Sentry/SentryOptions+HybridSDKs.h>
57
63
58
64
#import " RNSentryExperimentalOptions.h"
59
65
#import " RNSentryVersion.h"
60
-
61
- @interface
62
- SentrySDK (RNSentry)
63
-
64
- + (void )captureEnvelope:(SentryEnvelope *)envelope;
65
-
66
- + (void )storeEnvelope:(SentryEnvelope *)envelope;
67
-
68
- @end
66
+ #import " SentrySDKWrapper.h"
69
67
70
68
static bool hasFetchedAppStart;
71
69
@@ -112,7 +110,7 @@ - (instancetype)init
112
110
[PrivateSentrySDKOnly addSdkPackage: REACT_NATIVE_SDK_PACKAGE_NAME
113
111
version: REACT_NATIVE_SDK_PACKAGE_VERSION];
114
112
115
- [SentrySDK startWithOptions: sentryOptions];
113
+ [SentrySDKWrapper startWithOptions: sentryOptions];
116
114
117
115
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
118
116
BOOL appIsActive =
@@ -363,7 +361,11 @@ - (void)stopObserving
363
361
- (NSDictionary *)fetchNativeStackFramesBy : (NSArray <NSNumber *> *)instructionsAddr
364
362
symbolicate : (SymbolicateCallbackType)symbolicate
365
363
{
364
+ #if CROSS_PLATFORM_TEST
365
+ BOOL shouldSymbolicateLocally = [SentrySDKInternal.options debug ];
366
+ #else
366
367
BOOL shouldSymbolicateLocally = [SentrySDK.options debug ];
368
+ #endif
367
369
NSString *appPackageName = [[NSBundle mainBundle ] executablePath ];
368
370
369
371
NSMutableSet <NSString *> *_Nonnull imagesAddrToRetrieveDebugMetaImages =
@@ -451,7 +453,7 @@ - (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAd
451
453
__block NSMutableDictionary <NSString *, id > *serializedScope;
452
454
// Temp work around until sorted out this API in sentry-cocoa.
453
455
// TODO: If the callback isnt' executed the promise wouldn't be resolved.
454
- [SentrySDK configureScope: ^(SentryScope *_Nonnull scope) {
456
+ [SentrySDKWrapper configureScope: ^(SentryScope *_Nonnull scope) {
455
457
serializedScope = [[scope serialize ] mutableCopy ];
456
458
457
459
NSDictionary <NSString *, id > *user = [serializedScope valueForKey: @" user" ];
@@ -655,7 +657,7 @@ - (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAd
655
657
656
658
RCT_EXPORT_METHOD (setUser : (NSDictionary *)userKeys otherUserKeys : (NSDictionary *)userDataKeys)
657
659
{
658
- [SentrySDK configureScope: ^(SentryScope *_Nonnull scope) {
660
+ [SentrySDKWrapper configureScope: ^(SentryScope *_Nonnull scope) {
659
661
[scope setUser: [RNSentry userFrom: userKeys otherUserKeys: userDataKeys]];
660
662
}];
661
663
}
@@ -704,7 +706,7 @@ + (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
704
706
705
707
RCT_EXPORT_METHOD (addBreadcrumb : (NSDictionary *)breadcrumb)
706
708
{
707
- [SentrySDK configureScope: ^(SentryScope *_Nonnull scope) {
709
+ [SentrySDKWrapper configureScope: ^(SentryScope *_Nonnull scope) {
708
710
[scope addBreadcrumb: [RNSentryBreadcrumb from: breadcrumb]];
709
711
}];
710
712
@@ -718,12 +720,12 @@ + (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
718
720
719
721
RCT_EXPORT_METHOD (clearBreadcrumbs)
720
722
{
721
- [SentrySDK configureScope: ^(SentryScope *_Nonnull scope) { [scope clearBreadcrumbs ]; }];
723
+ [SentrySDKWrapper configureScope: ^(SentryScope *_Nonnull scope) { [scope clearBreadcrumbs ]; }];
722
724
}
723
725
724
726
RCT_EXPORT_METHOD (setExtra : (NSString *)key extra : (NSString *)extra)
725
727
{
726
- [SentrySDK
728
+ [SentrySDKWrapper
727
729
configureScope: ^(SentryScope *_Nonnull scope) { [scope setExtraValue: extra forKey: key]; }];
728
730
}
729
731
@@ -733,7 +735,7 @@ + (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
733
735
return ;
734
736
}
735
737
736
- [SentrySDK configureScope: ^(SentryScope *_Nonnull scope) {
738
+ [SentrySDKWrapper configureScope: ^(SentryScope *_Nonnull scope) {
737
739
if (context == nil ) {
738
740
[scope removeContextForKey: key];
739
741
} else {
@@ -744,17 +746,17 @@ + (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
744
746
745
747
RCT_EXPORT_METHOD (setTag : (NSString *)key value : (NSString *)value)
746
748
{
747
- [SentrySDK
749
+ [SentrySDKWrapper
748
750
configureScope: ^(SentryScope *_Nonnull scope) { [scope setTagValue: value forKey: key]; }];
749
751
}
750
752
751
- RCT_EXPORT_METHOD (crash) { [SentrySDK crash ]; }
753
+ RCT_EXPORT_METHOD (crash) { [SentrySDKWrapper crash ]; }
752
754
753
755
RCT_EXPORT_METHOD (closeNativeSdk
754
756
: (RCTPromiseResolveBlock)resolve rejecter
755
757
: (RCTPromiseRejectBlock)reject)
756
758
{
757
- [SentrySDK close ];
759
+ [SentrySDKWrapper close ];
758
760
resolve (@YES );
759
761
}
760
762
@@ -957,7 +959,7 @@ + (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
957
959
: (RCTPromiseResolveBlock)resolve rejecter
958
960
: (RCTPromiseRejectBlock)reject)
959
961
{
960
- resolve (@([SentrySDK crashedLastRun ]));
962
+ resolve (@([SentrySDKWrapper crashedLastRun ]));
961
963
}
962
964
963
965
// Thanks to this guard, we won't compile this code when we build for the old architecture.
0 commit comments