Skip to content
Closed
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
31 changes: 5 additions & 26 deletions Sources/Sentry/SentryScreenFrames.m
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
#import <SentryScreenFrames.h>

#if SENTRY_UIKIT_AVAILABLE
#if SENTRY_HAS_UIKIT
# import "SentryInternalDefines.h"

@implementation SentryScreenFrames

- (instancetype)initWithTotal:(NSUInteger)total frozen:(NSUInteger)frozen slow:(NSUInteger)slow
{
# if SENTRY_HAS_UIKIT
# if SENTRY_TARGET_PROFILING_SUPPORTED
# if SENTRY_TARGET_PROFILING_SUPPORTED
return [self initWithTotal:total
frozen:frozen
slow:slow
slowFrameTimestamps:@[]
frozenFrameTimestamps:@[]
frameRateTimestamps:@[]];
# else
# else
if (self = [super init]) {
_total = total;
_slow = slow;
_frozen = frozen;
}

return self;
# endif // SENTRY_TARGET_PROFILING_SUPPORTED
# else
SENTRY_GRACEFUL_FATAL(
@"SentryScreenFrames only works with UIKit enabled. Ensure you're using the "
@"right configuration of Sentry that links UIKit.");
return nil;
# endif // SENTRY_HAS_UIKIT
# endif // SENTRY_TARGET_PROFILING_SUPPORTED
}

# if SENTRY_TARGET_PROFILING_SUPPORTED
Expand All @@ -40,7 +33,6 @@ - (instancetype)initWithTotal:(NSUInteger)total
frozenFrameTimestamps:(SentryFrameInfoTimeSeries *)frozenFrameTimestamps
frameRateTimestamps:(SentryFrameInfoTimeSeries *)frameRateTimestamps
{
# if SENTRY_HAS_UIKIT
if (self = [super init]) {
_total = total;
_slow = slow;
Expand All @@ -51,29 +43,16 @@ - (instancetype)initWithTotal:(NSUInteger)total
}

return self;
# else
SENTRY_GRACEFUL_FATAL(
@"SentryScreenFrames only works with UIKit enabled. Ensure you're using the "
@"right configuration of Sentry that links UIKit.");
return nil;
# endif // SENTRY_HAS_UIKIT
}

- (nonnull id)copyWithZone:(nullable NSZone *)zone
{
# if SENTRY_HAS_UIKIT
return [[SentryScreenFrames allocWithZone:zone] initWithTotal:_total
frozen:_frozen
slow:_slow
slowFrameTimestamps:[_slowFrameTimestamps copy]
frozenFrameTimestamps:[_frozenFrameTimestamps copy]
frameRateTimestamps:[_frameRateTimestamps copy]];
# else
SENTRY_GRACEFUL_FATAL(
@"SentryScreenFrames only works with UIKit enabled. Ensure you're using the "
@"right configuration of Sentry that links UIKit.");
return nil;
# endif // SENTRY_HAS_UIKIT
}

# endif // SENTRY_TARGET_PROFILING_SUPPORTED
Expand All @@ -93,4 +72,4 @@ - (NSString *)description

@end

#endif // SENTRY_UIKIT_AVAILABLE
#endif // SENTRY_HAS_UIKIT
8 changes: 2 additions & 6 deletions Sources/Sentry/include/HybridPublic/SentryScreenFrames.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# import "PrivatesHeader.h"
#endif

#if SENTRY_UIKIT_AVAILABLE
#if SENTRY_HAS_UIKIT

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -13,10 +13,6 @@ NS_ASSUME_NONNULL_BEGIN
typedef NSArray<NSDictionary<NSString *, NSNumber *> *> SentryFrameInfoTimeSeries;
# endif // SENTRY_TARGET_PROFILING_SUPPORTED

/**
* @warning This feature is not available in @c DebugWithoutUIKit and @c ReleaseWithoutUIKit
* configurations even when targeting iOS or tvOS platforms.
*/
@interface SentryScreenFrames : NSObject
# if SENTRY_TARGET_PROFILING_SUPPORTED
<NSCopying>
Expand Down Expand Up @@ -63,4 +59,4 @@ SENTRY_NO_INIT

NS_ASSUME_NONNULL_END

#endif // SENTRY_UIKIT_AVAILABLE
#endif // SENTRY_HAS_UIKIT
Loading