From e6daf0bb20e56cb41a5f9a5a40c6e7c06e51552f Mon Sep 17 00:00:00 2001 From: Noah Martin Date: Wed, 1 Oct 2025 09:28:46 -0400 Subject: [PATCH] chore: Cleanup interface for SentryScreenFrames without UIKit --- Sources/Sentry/SentryScreenFrames.m | 31 +++---------------- .../include/HybridPublic/SentryScreenFrames.h | 8 ++--- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/Sources/Sentry/SentryScreenFrames.m b/Sources/Sentry/SentryScreenFrames.m index 6f2bf9c0ea6..e8ee29acd9e 100644 --- a/Sources/Sentry/SentryScreenFrames.m +++ b/Sources/Sentry/SentryScreenFrames.m @@ -1,21 +1,20 @@ #import -#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; @@ -23,13 +22,7 @@ - (instancetype)initWithTotal:(NSUInteger)total frozen:(NSUInteger)frozen slow:( } 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 @@ -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; @@ -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 @@ -93,4 +72,4 @@ - (NSString *)description @end -#endif // SENTRY_UIKIT_AVAILABLE +#endif // SENTRY_HAS_UIKIT diff --git a/Sources/Sentry/include/HybridPublic/SentryScreenFrames.h b/Sources/Sentry/include/HybridPublic/SentryScreenFrames.h index d7c0351a4d3..381a1fa45a9 100644 --- a/Sources/Sentry/include/HybridPublic/SentryScreenFrames.h +++ b/Sources/Sentry/include/HybridPublic/SentryScreenFrames.h @@ -4,7 +4,7 @@ # import "PrivatesHeader.h" #endif -#if SENTRY_UIKIT_AVAILABLE +#if SENTRY_HAS_UIKIT NS_ASSUME_NONNULL_BEGIN @@ -13,10 +13,6 @@ NS_ASSUME_NONNULL_BEGIN typedef NSArray *> 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 @@ -63,4 +59,4 @@ SENTRY_NO_INIT NS_ASSUME_NONNULL_END -#endif // SENTRY_UIKIT_AVAILABLE +#endif // SENTRY_HAS_UIKIT