Skip to content
Open
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
16 changes: 5 additions & 11 deletions packages/core/ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#import <Sentry/SentryFormatter.h>
#import <Sentry/SentryOptions.h>
#import <Sentry/SentryOptionsInternal.h>
#import <Sentry/SentryScreenFrames.h>
#import <Sentry/SentryUser.h>

// This guard prevents importing Hermes in JSC apps
Expand Down Expand Up @@ -57,6 +56,7 @@
#import "RNSentryExperimentalOptions.h"
#import "RNSentryVersion.h"
#import "SentrySDKWrapper.h"
#import "SentryScreenFramesWrapper.h"

static bool hasFetchedAppStart;

Expand Down Expand Up @@ -580,21 +580,15 @@ - (void)stopObserving

#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
if (PrivateSentrySDKOnly.isFramesTrackingRunning) {
SentryScreenFrames *frames = PrivateSentrySDKOnly.currentScreenFrames;

if (frames == nil) {
if (![SentryScreenFramesWrapper canTrackFrames]) {
resolve(nil);
return;
}

NSNumber *total = [NSNumber numberWithLong:frames.total];
NSNumber *frozen = [NSNumber numberWithLong:frames.frozen];
NSNumber *slow = [NSNumber numberWithLong:frames.slow];

resolve(@ {
@"totalFrames" : total,
@"frozenFrames" : frozen,
@"slowFrames" : slow,
@"totalFrames" : [SentryScreenFramesWrapper totalFrames],
@"frozenFrames" : [SentryScreenFramesWrapper frozenFrames],
@"slowFrames" : [SentryScreenFramesWrapper slowFrames],
});
} else {
resolve(nil);
Expand Down
10 changes: 10 additions & 0 deletions packages/core/ios/SentryScreenFramesWrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#import <Foundation/Foundation.h>

@interface SentryScreenFramesWrapper : NSObject

+ (BOOL)canTrackFrames;
+ (NSNumber *)totalFrames;
+ (NSNumber *)frozenFrames;
+ (NSNumber *)slowFrames;

@end
35 changes: 35 additions & 0 deletions packages/core/ios/SentryScreenFramesWrapper.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#import "SentryScreenFramesWrapper.h"
@import Sentry;

@implementation SentryScreenFramesWrapper

+ (BOOL)canTrackFrames
{
return PrivateSentrySDKOnly.currentScreenFrames != nil;

Check failure on line 8 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos production no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'

Check failure on line 8 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos dev no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'
}

+ (NSNumber *)totalFrames
{
if (![self canTrackFrames]) {
return nil;
}
return [NSNumber numberWithLong:PrivateSentrySDKOnly.currentScreenFrames.total];

Check failure on line 16 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos production no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'

Check failure on line 16 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos dev no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'
}

+ (NSNumber *)frozenFrames
{
if (![self canTrackFrames]) {
return nil;
}
return [NSNumber numberWithLong:PrivateSentrySDKOnly.currentScreenFrames.frozen];

Check failure on line 24 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos production no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'

Check failure on line 24 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos dev no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'
}

+ (NSNumber *)slowFrames
{
if (![self canTrackFrames]) {
return nil;
}
return [NSNumber numberWithLong:PrivateSentrySDKOnly.currentScreenFrames.slow];

Check failure on line 32 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos production no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'

Check failure on line 32 in packages/core/ios/SentryScreenFramesWrapper.m

View workflow job for this annotation

GitHub Actions / Build legacy macos dev no-frameworks

property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'
}

@end
Loading