Skip to content
Merged
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
28 changes: 2 additions & 26 deletions Sources/Sentry/PrivateSentrySDKOnly.mm
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ + (SentryBreadcrumb *)breadcrumbWithDictionary:(NSDictionary *)dictionary
return [[SentryBreadcrumb alloc] initWithDictionary:dictionary];
}

#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED
+ (nullable SentrySessionReplayIntegration *)getReplayIntegration
{

Expand All @@ -320,30 +320,17 @@ + (nullable SentrySessionReplayIntegration *)getReplayIntegration

return replayIntegration;
}
#endif

+ (void)captureReplay
{
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
[[PrivateSentrySDKOnly getReplayIntegration] captureReplay];
#else
SENTRY_LOG_DEBUG(
@"SentrySessionReplayIntegration only works with UIKit enabled and target is "
@"not visionOS. Ensure you're using the right configuration of Sentry that links UIKit.");
#endif
}

+ (void)configureSessionReplayWith:(nullable id<SentryReplayBreadcrumbConverter>)breadcrumbConverter
screenshotProvider:(nullable id<SentryViewScreenshotProvider>)screenshotProvider
{
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
[[PrivateSentrySDKOnly getReplayIntegration] configureReplayWith:breadcrumbConverter
screenshotProvider:screenshotProvider];
#else
SENTRY_LOG_DEBUG(
@"SentrySessionReplayIntegration only works with UIKit enabled and target is "
@"not visionOS. Ensure you're using the right configuration of Sentry that links UIKit.");
#endif
}

+ (NSString *__nullable)getReplayId
Expand All @@ -357,24 +344,13 @@ + (NSString *__nullable)getReplayId

+ (void)addReplayIgnoreClasses:(NSArray<Class> *_Nonnull)classes
{
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
[SentryViewPhotographer.shared addIgnoreClasses:classes];
#else
SENTRY_LOG_DEBUG(
@"PrivateSentrySDKOnly.addReplayIgnoreClasses only works with UIKit enabled and target is "
@"not visionOS. Ensure you're using the right configuration of Sentry that links UIKit.");
#endif
}

+ (void)addReplayRedactClasses:(NSArray<Class> *_Nonnull)classes
{
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
[SentryViewPhotographer.shared addRedactClasses:classes];
#else
SENTRY_LOG_DEBUG(
@"PrivateSentrySDKOnly.addReplayRedactClasses only works with UIKit enabled and target is "
@"not visionOS. Ensure you're using the right configuration of Sentry that links UIKit.");
#endif
}
#endif

@end
6 changes: 6 additions & 0 deletions Sources/Sentry/Public/SentryDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
# define SENTRY_HAS_METRIC_KIT 0
#endif

#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
# define SENTRY_TARGET_REPLAY_SUPPORTED 1
#else
# define SENTRY_TARGET_REPLAY_SUPPORTED 0
#endif

#define SENTRY_NO_INIT \
-(instancetype)init NS_UNAVAILABLE; \
+(instancetype) new NS_UNAVAILABLE;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryCrashWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ - (void)enrichScope:(SentryScope *)scope
[deviceData setValue:locale forKey:LOCALE_KEY];

// The UIWindowScene is unavailable on visionOS
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED

NSArray<UIWindow *> *appWindows = SentryDependencyContainer.sharedInstance.application.windows;
if ([appWindows count] > 0) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentrySessionReplay.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#import "SentrySwift.h"
#import "SentryTraceContext.h"

#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED

NS_ASSUME_NONNULL_BEGIN

Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentrySessionReplayIntegration.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "SentrySessionReplayIntegration+Private.h"

#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED

# import "SentryClient+Private.h"
# import "SentryDependencyContainer.h"
Expand Down
12 changes: 6 additions & 6 deletions Sources/Sentry/include/HybridPublic/PrivateSentrySDKOnly.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ typedef void (^SentryOnAppStartMeasurementAvailable)(

#endif // SENTRY_UIKIT_AVAILABLE

#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED

/**
* Configure session replay with different breadcrumb converter
Expand All @@ -173,18 +173,18 @@ typedef void (^SentryOnAppStartMeasurementAvailable)(
+ (void)configureSessionReplayWith:(nullable id<SentryReplayBreadcrumbConverter>)breadcrumbConverter
screenshotProvider:(nullable id<SentryViewScreenshotProvider>)screenshotProvider;

+ (void)captureReplay;
+ (NSString *__nullable)getReplayId;
+ (void)addReplayIgnoreClasses:(NSArray<Class> *_Nonnull)classes;
+ (void)addReplayRedactClasses:(NSArray<Class> *_Nonnull)classes;

#endif
+ (nullable NSDictionary<NSString *, id> *)appStartMeasurementWithSpans;

+ (SentryUser *)userWithDictionary:(NSDictionary *)dictionary;

+ (SentryBreadcrumb *)breadcrumbWithDictionary:(NSDictionary *)dictionary;

+ (void)captureReplay;
+ (NSString *__nullable)getReplayId;
+ (void)addReplayIgnoreClasses:(NSArray<Class> *_Nonnull)classes;
+ (void)addReplayRedactClasses:(NSArray<Class> *_Nonnull)classes;

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion Sources/Sentry/include/SentrySessionReplay.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import "SentryDefines.h"
#import <Foundation/Foundation.h>

#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED
# import <UIKit/UIKit.h>

@class SentryReplayOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#import "SentrySessionReplayIntegration.h"
#import "SentrySwift.h"

#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED

@class SentrySessionReplay;

Expand Down
4 changes: 2 additions & 2 deletions Sources/Sentry/include/SentrySessionReplayIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#if SENTRY_TARGET_REPLAY_SUPPORTED

@protocol SentryReplayBreadcrumbConverter;
@protocol SentryViewScreenshotProvider;
Expand All @@ -24,5 +24,5 @@ NS_ASSUME_NONNULL_BEGIN
screenshotProvider:(nullable id<SentryViewScreenshotProvider>)screenshotProvider;

@end
#endif // SENTRY_HAS_UIKIT && !TARGET_OS_VISION
#endif // SENTRY_TARGET_REPLAY_SUPPORTED
NS_ASSUME_NONNULL_END
12 changes: 0 additions & 12 deletions Tests/SentryTests/PrivateSentrySDKOnlyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,6 @@ class PrivateSentrySDKOnlyTests: XCTestCase {

#endif

func testCaptureReplayShouldNotFailIfMissingReplayIntegration() {
PrivateSentrySDKOnly.captureReplay()
}

func testAddReplayIgnoreClassesShouldNotFailIfMissingReplayIntegration() {
PrivateSentrySDKOnly.addReplayIgnoreClasses([])
}

func testAddReplayRedactShouldNotFailIfMissingReplayIntegration() {
PrivateSentrySDKOnly.addReplayRedactClasses([])
}

#if canImport(UIKit)
func testCaptureReplayShouldCallReplayIntegration() {
guard #available(iOS 16.0, tvOS 16.0, *) else { return }
Expand Down