Skip to content

Commit d9280ee

Browse files
authored
chore: Exposing SessionReplayIntegration to hybrid SDKs (#4027)
Now its possible to get a instance of SentrySessionReplayIntegration from [PrivateSentrySDKOnly createReplayIntegration]
1 parent beb7ff7 commit d9280ee

15 files changed

+157
-66
lines changed

Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#import "AppDelegate.h"
22
@import CoreData;
33
@import Sentry;
4-
54
@interface
65
AppDelegate ()
76

Sentry.xcodeproj/project.pbxproj

+10-9
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@
813813
D820CDB72BB1895F00BA339D /* SentrySessionReplayIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = D820CDB62BB1895F00BA339D /* SentrySessionReplayIntegration.m */; };
814814
D820CDB82BB1895F00BA339D /* SentrySessionReplayIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = D820CDB52BB1895F00BA339D /* SentrySessionReplayIntegration.h */; };
815815
D8292D7D2A39A027009872F7 /* UrlSanitizedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8292D7C2A39A027009872F7 /* UrlSanitizedTests.swift */; };
816-
D82DD1CD2BEEB1A0001AB556 /* SentryBreadcrumbReplayConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82DD1CC2BEEB1A0001AB556 /* SentryBreadcrumbReplayConverterTests.swift */; };
816+
D82DD1CD2BEEB1A0001AB556 /* SentrySRDefaultBreadcrumbConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82DD1CC2BEEB1A0001AB556 /* SentrySRDefaultBreadcrumbConverterTests.swift */; };
817817
D8370B6A273DF1E900F66E2D /* SentryNSURLSessionTaskSearch.m in Sources */ = {isa = PBXBuildFile; fileRef = D8370B68273DF1E900F66E2D /* SentryNSURLSessionTaskSearch.m */; };
818818
D8370B6C273DF20F00F66E2D /* SentryNSURLSessionTaskSearch.h in Headers */ = {isa = PBXBuildFile; fileRef = D8370B6B273DF20F00F66E2D /* SentryNSURLSessionTaskSearch.h */; };
819819
D83D079B2B7F9D1C00CC9674 /* SentryMsgPackSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = D83D07992B7F9D1C00CC9674 /* SentryMsgPackSerializer.h */; };
@@ -882,7 +882,6 @@
882882
D8AFC03D2BDA79BF00118BE1 /* SentryReplayVideoMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8AFC03C2BDA79BF00118BE1 /* SentryReplayVideoMaker.swift */; };
883883
D8AFC0572BDA895400118BE1 /* UIRedactBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8AFC0562BDA895400118BE1 /* UIRedactBuilder.swift */; };
884884
D8AFC05A2BDA89C100118BE1 /* RedactRegionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8AFC0582BDA899A00118BE1 /* RedactRegionTests.swift */; };
885-
D8AFC0622BDBEE4200118BE1 /* SentrySessionReplayIntegration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = D8AFC0612BDBEDF100118BE1 /* SentrySessionReplayIntegration+Private.h */; };
886885
D8B0542E2A7D2C720056BAF6 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D8B0542D2A7D2C720056BAF6 /* PrivacyInfo.xcprivacy */; };
887886
D8B088B629C9E3FF00213258 /* SentryTracerConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B088B429C9E3FF00213258 /* SentryTracerConfiguration.h */; };
888887
D8B088B729C9E3FF00213258 /* SentryTracerConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = D8B088B529C9E3FF00213258 /* SentryTracerConfiguration.m */; };
@@ -922,7 +921,7 @@
922921
D8F67AEE2BE0D19200C9197B /* UIImageHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F67AED2BE0D19200C9197B /* UIImageHelper.swift */; };
923922
D8F67AF12BE0D33F00C9197B /* UIImageHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F67AEF2BE0D31A00C9197B /* UIImageHelperTests.swift */; };
924923
D8F67AF42BE10F9600C9197B /* UIRedactBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F67AF22BE10F7600C9197B /* UIRedactBuilderTests.swift */; };
925-
D8F67B1B2BE9728600C9197B /* SentryReplayBreadcrumbConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F67B1A2BE9728600C9197B /* SentryReplayBreadcrumbConverter.swift */; };
924+
D8F67B1B2BE9728600C9197B /* SentrySRDefaultBreadcrumbConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F67B1A2BE9728600C9197B /* SentrySRDefaultBreadcrumbConverter.swift */; };
926925
D8F67B222BEAB6CC00C9197B /* SentryRRWebEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F67B212BEAB6CC00C9197B /* SentryRRWebEvent.swift */; };
927926
D8F6A2472885512100320515 /* SentryPredicateDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F6A2452885512100320515 /* SentryPredicateDescriptor.m */; };
928927
D8F6A24B2885515C00320515 /* SentryPredicateDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = D8F6A24A2885515B00320515 /* SentryPredicateDescriptor.h */; };
@@ -1843,6 +1842,7 @@
18431842
D801990F286B089000C277F0 /* SentryCrashReportSinkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashReportSinkTests.swift; sourceTree = "<group>"; };
18441843
D802994D2BA836EF000F0081 /* SentryOnDemandReplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryOnDemandReplay.swift; sourceTree = "<group>"; };
18451844
D802994F2BA83A88000F0081 /* SentryPixelBuffer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryPixelBuffer.swift; sourceTree = "<group>"; };
1845+
D80382BE2C09C6FD0090E048 /* SentrySessionReplayIntegration-Hybrid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentrySessionReplayIntegration-Hybrid.h"; path = "include/HybridPublic/SentrySessionReplayIntegration-Hybrid.h"; sourceTree = "<group>"; };
18461846
D80694C22B7CC86E00B820E6 /* SentryReplayEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryReplayEventTests.swift; sourceTree = "<group>"; };
18471847
D80694C52B7CCFA100B820E6 /* SentryReplayRecordingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryReplayRecordingTests.swift; sourceTree = "<group>"; };
18481848
D80694CB2B7E0A3E00B820E6 /* SentryReplayType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryReplayType.h; path = include/SentryReplayType.h; sourceTree = "<group>"; };
@@ -1874,7 +1874,7 @@
18741874
D820CDB62BB1895F00BA339D /* SentrySessionReplayIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySessionReplayIntegration.m; sourceTree = "<group>"; };
18751875
D8292D7A2A38AF04009872F7 /* HTTPHeaderSanitizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPHeaderSanitizer.swift; sourceTree = "<group>"; };
18761876
D8292D7C2A39A027009872F7 /* UrlSanitizedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UrlSanitizedTests.swift; sourceTree = "<group>"; };
1877-
D82DD1CC2BEEB1A0001AB556 /* SentryBreadcrumbReplayConverterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryBreadcrumbReplayConverterTests.swift; sourceTree = "<group>"; };
1877+
D82DD1CC2BEEB1A0001AB556 /* SentrySRDefaultBreadcrumbConverterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySRDefaultBreadcrumbConverterTests.swift; sourceTree = "<group>"; };
18781878
D8370B68273DF1E900F66E2D /* SentryNSURLSessionTaskSearch.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryNSURLSessionTaskSearch.m; sourceTree = "<group>"; };
18791879
D8370B6B273DF20F00F66E2D /* SentryNSURLSessionTaskSearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryNSURLSessionTaskSearch.h; path = include/SentryNSURLSessionTaskSearch.h; sourceTree = "<group>"; };
18801880
D83D07992B7F9D1C00CC9674 /* SentryMsgPackSerializer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryMsgPackSerializer.h; path = include/SentryMsgPackSerializer.h; sourceTree = "<group>"; };
@@ -1994,7 +1994,7 @@
19941994
D8F67AED2BE0D19200C9197B /* UIImageHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageHelper.swift; sourceTree = "<group>"; };
19951995
D8F67AEF2BE0D31A00C9197B /* UIImageHelperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageHelperTests.swift; sourceTree = "<group>"; };
19961996
D8F67AF22BE10F7600C9197B /* UIRedactBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIRedactBuilderTests.swift; sourceTree = "<group>"; };
1997-
D8F67B1A2BE9728600C9197B /* SentryReplayBreadcrumbConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryReplayBreadcrumbConverter.swift; sourceTree = "<group>"; };
1997+
D8F67B1A2BE9728600C9197B /* SentrySRDefaultBreadcrumbConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySRDefaultBreadcrumbConverter.swift; sourceTree = "<group>"; };
19981998
D8F67B212BEAB6CC00C9197B /* SentryRRWebEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryRRWebEvent.swift; sourceTree = "<group>"; };
19991999
D8F6A2452885512100320515 /* SentryPredicateDescriptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryPredicateDescriptor.m; sourceTree = "<group>"; };
20002000
D8F6A24A2885515B00320515 /* SentryPredicateDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryPredicateDescriptor.h; path = include/SentryPredicateDescriptor.h; sourceTree = "<group>"; };
@@ -3600,6 +3600,7 @@
36003600
D86130112BB563FD004C0F5E /* SentrySessionReplayIntegrationTests.swift */,
36013601
D861301B2BB5A267004C0F5E /* SentrySessionReplayTests.swift */,
36023602
D8AFC0002BD252B900118BE1 /* SentryOnDemandReplayTests.swift */,
3603+
D82DD1CC2BEEB1A0001AB556 /* SentrySRDefaultBreadcrumbConverterTests.swift */,
36033604
D82DD1CC2BEEB1A0001AB556 /* SentryBreadcrumbReplayConverterTests.swift */,
36043605
D8DBE0C92C0E093000FAB1FD /* SentryTouchTrackerTests.swift */,
36053606
D8DBE0D12C0EFFC300FAB1FD /* SentryReplayOptionsTests.swift */,
@@ -3628,6 +3629,7 @@
36283629
D820CDB52BB1895F00BA339D /* SentrySessionReplayIntegration.h */,
36293630
D8AFC0612BDBEDF100118BE1 /* SentrySessionReplayIntegration+Private.h */,
36303631
D820CDB62BB1895F00BA339D /* SentrySessionReplayIntegration.m */,
3632+
D80382BE2C09C6FD0090E048 /* SentrySessionReplayIntegration-Hybrid.h */,
36313633
);
36323634
name = SessionReplay;
36333635
sourceTree = "<group>";
@@ -3872,7 +3874,7 @@
38723874
D802994D2BA836EF000F0081 /* SentryOnDemandReplay.swift */,
38733875
D802994F2BA83A88000F0081 /* SentryPixelBuffer.swift */,
38743876
D8AFC03C2BDA79BF00118BE1 /* SentryReplayVideoMaker.swift */,
3875-
D8F67B1A2BE9728600C9197B /* SentryReplayBreadcrumbConverter.swift */,
3877+
D8F67B1A2BE9728600C9197B /* SentrySRDefaultBreadcrumbConverter.swift */,
38763878
D81988BF2BEBFFF70020E36C /* SentryReplayRecording.swift */,
38773879
D8BC28C72BFF5EBB0054DA4D /* SentryTouchTracker.swift */,
38783880
);
@@ -4073,7 +4075,6 @@
40734075
6383953623ABA42C000C1594 /* SentryHttpTransport.h in Headers */,
40744076
84A8891C28DBD28900C51DFD /* SentryDevice.h in Headers */,
40754077
8E564AEF267AF24400FE117D /* SentryNetworkTracker.h in Headers */,
4076-
D8AFC0622BDBEE4200118BE1 /* SentrySessionReplayIntegration+Private.h in Headers */,
40774078
63FE715120DA4C1100CDBAE8 /* SentryCrashDebug.h in Headers */,
40784079
63FE70F520DA4C1000CDBAE8 /* SentryCrashMonitor_System.h in Headers */,
40794080
7B31C291277B04A000337126 /* SentryCrashPlatformSpecificDefines.h in Headers */,
@@ -4734,7 +4735,7 @@
47344735
D81988C72BEC18E20020E36C /* SentryRRWebVideoEvent.swift in Sources */,
47354736
621F61F12BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift in Sources */,
47364737
D88817D826D7149100BF2251 /* SentryTraceContext.m in Sources */,
4737-
D8F67B1B2BE9728600C9197B /* SentryReplayBreadcrumbConverter.swift in Sources */,
4738+
D8F67B1B2BE9728600C9197B /* SentrySRDefaultBreadcrumbConverter.swift in Sources */,
47384739
8EBF870926140D37001A6853 /* SentryPerformanceTracker.m in Sources */,
47394740
D80CD8D02B75143F002F710B /* UrlSanitized.swift in Sources */,
47404741
D8F016B32B9622D6007B9AFB /* SentryId.swift in Sources */,
@@ -5001,7 +5002,7 @@
50015002
62B86CFC29F052BB008F3947 /* SentryTestLogConfig.m in Sources */,
50025003
D808FB92281BF6EC009A2A33 /* SentryUIEventTrackingIntegrationTests.swift in Sources */,
50035004
7BC6EC04255C235F0059822A /* SentryFrameTests.swift in Sources */,
5004-
D82DD1CD2BEEB1A0001AB556 /* SentryBreadcrumbReplayConverterTests.swift in Sources */,
5005+
D82DD1CD2BEEB1A0001AB556 /* SentrySRDefaultBreadcrumbConverterTests.swift in Sources */,
50055006
0AE455AD28F584D2006680E5 /* SentryReachabilityTests.m in Sources */,
50065007
63FE720420DA66EC00CDBAE8 /* SentryCrashString_Tests.m in Sources */,
50075008
62872B632BA1B86100A4FA7D /* NSLockTests.swift in Sources */,

Sources/Sentry/PrivateSentrySDKOnly.mm

+34-23
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import "SentryOptions.h"
1212
#import "SentrySDK+Private.h"
1313
#import "SentrySerialization.h"
14+
#import "SentrySessionReplayIntegration.h"
1415
#import "SentrySwift.h"
1516
#import "SentryThreadHandle.hpp"
1617
#import "SentryUser+Private.h"
@@ -304,24 +305,43 @@ + (SentryBreadcrumb *)breadcrumbWithDictionary:(NSDictionary *)dictionary
304305
return [[SentryBreadcrumb alloc] initWithDictionary:dictionary];
305306
}
306307

308+
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
309+
+ (nullable SentrySessionReplayIntegration *)getReplayIntegration
310+
{
311+
312+
NSArray *integrations = [[SentrySDK currentHub] installedIntegrations];
313+
SentrySessionReplayIntegration *replayIntegration;
314+
for (id obj in integrations) {
315+
if ([obj isKindOfClass:[SentrySessionReplayIntegration class]]) {
316+
replayIntegration = obj;
317+
break;
318+
}
319+
}
320+
321+
return replayIntegration;
322+
}
323+
#endif
324+
307325
+ (void)captureReplay
308326
{
309327
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
310-
if (@available(iOS 16.0, *)) {
311-
NSArray *integrations = [[SentrySDK currentHub] installedIntegrations];
312-
SentrySessionReplayIntegration *replayIntegration;
313-
for (id obj in integrations) {
314-
if ([obj isKindOfClass:[SentrySessionReplayIntegration class]]) {
315-
replayIntegration = obj;
316-
break;
317-
}
318-
}
328+
[[PrivateSentrySDKOnly getReplayIntegration] captureReplay];
329+
#else
330+
SENTRY_LOG_DEBUG(
331+
@"SentrySessionReplayIntegration only works with UIKit enabled and target is "
332+
@"not visionOS. Ensure you're using the right configuration of Sentry that links UIKit.");
333+
#endif
334+
}
319335

320-
[replayIntegration captureReplay];
321-
}
336+
+ (void)configureSessionReplayWith:(nullable id<SentryReplayBreadcrumbConverter>)breadcrumbConverter
337+
screenshotProvider:(nullable id<SentryViewScreenshotProvider>)screenshotProvider
338+
{
339+
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
340+
[[PrivateSentrySDKOnly getReplayIntegration] configureReplayWith:breadcrumbConverter
341+
screenshotProvider:screenshotProvider];
322342
#else
323343
SENTRY_LOG_DEBUG(
324-
@"PrivateSentrySDKOnly.captureReplay only works with UIKit enabled and target is "
344+
@"SentrySessionReplayIntegration only works with UIKit enabled and target is "
325345
@"not visionOS. Ensure you're using the right configuration of Sentry that links UIKit.");
326346
#endif
327347
}
@@ -338,11 +358,7 @@ + (NSString *__nullable)getReplayId
338358
+ (void)addReplayIgnoreClasses:(NSArray<Class> *_Nonnull)classes
339359
{
340360
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
341-
if (@available(iOS 16.0, tvOS 16.0, *)) {
342-
[SentryViewPhotographer.shared addIgnoreClasses:classes];
343-
} else {
344-
SENTRY_LOG_DEBUG(@"PrivateSentrySDKOnly.addIgnoreClasses only works with iOS 16 and newer");
345-
}
361+
[SentryViewPhotographer.shared addIgnoreClasses:classes];
346362
#else
347363
SENTRY_LOG_DEBUG(
348364
@"PrivateSentrySDKOnly.addReplayIgnoreClasses only works with UIKit enabled and target is "
@@ -353,12 +369,7 @@ + (void)addReplayIgnoreClasses:(NSArray<Class> *_Nonnull)classes
353369
+ (void)addReplayRedactClasses:(NSArray<Class> *_Nonnull)classes
354370
{
355371
#if SENTRY_HAS_UIKIT && !TARGET_OS_VISION
356-
if (@available(iOS 16.0, tvOS 16.0, *)) {
357-
[SentryViewPhotographer.shared addRedactClasses:classes];
358-
} else {
359-
SENTRY_LOG_DEBUG(
360-
@"PrivateSentrySDKOnly.addReplayRedactClasses only works with iOS 16 and newer");
361-
}
372+
[SentryViewPhotographer.shared addRedactClasses:classes];
362373
#else
363374
SENTRY_LOG_DEBUG(
364375
@"PrivateSentrySDKOnly.addReplayRedactClasses only works with UIKit enabled and target is "

Sources/Sentry/SentrySessionReplay.m

+2-3
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,17 @@ @implementation SentrySessionReplay {
3939
SentryDisplayLinkWrapper *_displayLink;
4040
SentryCurrentDateProvider *_dateProvider;
4141
id<SentryRandom> _sentryRandom;
42-
id<SentryViewScreenshotProvider> _screenshotProvider;
4342
int _currentSegmentId;
4443
BOOL _processingScreenshot;
4544
BOOL _reachedMaximumDuration;
4645
SentryTouchTracker *_touchTracker;
47-
SentryReplayBreadcrumbConverter *_breadcrumbConverter;
4846
}
4947

5048
- (instancetype)initWithSettings:(SentryReplayOptions *)replayOptions
5149
replayFolderPath:(NSURL *)folderPath
5250
screenshotProvider:(id<SentryViewScreenshotProvider>)screenshotProvider
5351
replayMaker:(id<SentryReplayVideoMaker>)replayMaker
52+
breadcrumbConverter:(id<SentryReplayBreadcrumbConverter>)breadcrumbConverter
5453
touchTracker:(SentryTouchTracker *)touchTracker
5554
dateProvider:(SentryCurrentDateProvider *)dateProvider
5655
random:(id<SentryRandom>)random
@@ -66,8 +65,8 @@ - (instancetype)initWithSettings:(SentryReplayOptions *)replayOptions
6665
_urlToCache = folderPath;
6766
_replayMaker = replayMaker;
6867
_reachedMaximumDuration = NO;
68+
_breadcrumbConverter = breadcrumbConverter;
6969
_touchTracker = touchTracker;
70-
_breadcrumbConverter = [[SentryReplayBreadcrumbConverter alloc] init];
7170
}
7271
return self;
7372
}

Sources/Sentry/SentrySessionReplayIntegration.m

+32-8
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ - (void)newSceneActivate
8888

8989
- (void)startWithOptions:(SentryReplayOptions *)replayOptions
9090
fullSession:(BOOL)shouldReplayFullSession
91+
{
92+
[self startWithOptions:replayOptions
93+
screenshotProvider:SentryViewPhotographer.shared
94+
breadcrumbConverter:[[SentrySRDefaultBreadcrumbConverter alloc] init]
95+
fullSession:shouldReplayFullSession];
96+
}
97+
98+
- (void)startWithOptions:(SentryReplayOptions *)replayOptions
99+
screenshotProvider:(id<SentryViewScreenshotProvider>)screenshotProvider
100+
breadcrumbConverter:(id<SentryReplayBreadcrumbConverter>)breadcrumbConverter
101+
fullSession:(BOOL)shouldReplayFullSession
91102
{
92103
if (@available(iOS 16.0, tvOS 16.0, *)) {
93104
NSURL *docs = [NSURL
@@ -111,14 +122,15 @@ - (void)startWithOptions:(SentryReplayOptions *)replayOptions
111122
: replayOptions.errorReplayDuration);
112123

113124
self.sessionReplay = [[SentrySessionReplay alloc]
114-
initWithSettings:replayOptions
115-
replayFolderPath:docs
116-
screenshotProvider:SentryViewPhotographer.shared
117-
replayMaker:replayMaker
118-
touchTracker:_touchTracker
119-
dateProvider:SentryDependencyContainer.sharedInstance.dateProvider
120-
random:SentryDependencyContainer.sharedInstance.random
121-
displayLinkWrapper:[[SentryDisplayLinkWrapper alloc] init]];
125+
initWithSettings:replayOptions
126+
replayFolderPath:docs
127+
screenshotProvider:screenshotProvider
128+
replayMaker:replayMaker
129+
breadcrumbConverter:breadcrumbConverter
130+
touchTracker:_touchTracker
131+
dateProvider:SentryDependencyContainer.sharedInstance.dateProvider
132+
random:SentryDependencyContainer.sharedInstance.random
133+
displayLinkWrapper:[[SentryDisplayLinkWrapper alloc] init]];
122134

123135
[self.sessionReplay
124136
start:SentryDependencyContainer.sharedInstance.application.windows.firstObject
@@ -147,6 +159,18 @@ - (void)captureReplay
147159
[self.sessionReplay captureReplay];
148160
}
149161

162+
- (void)configureReplayWith:(nullable id<SentryReplayBreadcrumbConverter>)breadcrumbConverter
163+
screenshotProvider:(nullable id<SentryViewScreenshotProvider>)screenshotProvider
164+
{
165+
if (breadcrumbConverter) {
166+
self.sessionReplay.breadcrumbConverter = breadcrumbConverter;
167+
}
168+
169+
if (screenshotProvider) {
170+
self.sessionReplay.screenshotProvider = screenshotProvider;
171+
}
172+
}
173+
150174
- (SentryIntegrationOption)integrationOptions
151175
{
152176
return kIntegrationOptionEnableReplay;

0 commit comments

Comments
 (0)