Skip to content

Commit fafba63

Browse files
authored
ref: Move session replay integration out of hybrid SDK (#6911)
1 parent 13d625a commit fafba63

File tree

9 files changed

+65
-56
lines changed

9 files changed

+65
-56
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,6 @@
711711
92235CAC2E15369900865983 /* SentryLogBatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92235CAB2E15369900865983 /* SentryLogBatcher.swift */; };
712712
92235CAE2E15549C00865983 /* SentryLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92235CAD2E15549C00865983 /* SentryLogger.swift */; };
713713
92235CB02E155B2600865983 /* SentryLoggerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92235CAF2E155B2600865983 /* SentryLoggerTests.swift */; };
714-
925824C22CB5897700C9B20B /* SentrySessionReplayIntegration-Hybrid.h in Headers */ = {isa = PBXBuildFile; fileRef = D80382BE2C09C6FD0090E048 /* SentrySessionReplayIntegration-Hybrid.h */; settings = {ATTRIBUTES = (Private, ); }; };
715714
9264E1EB2E2E385E00B077CF /* SentryLogMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9264E1EA2E2E385B00B077CF /* SentryLogMessage.swift */; };
716715
9264E1ED2E2E397C00B077CF /* SentryLogMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9264E1EC2E2E397400B077CF /* SentryLogMessageTests.swift */; };
717716
92672BB629C9A2A9006B021C /* SentryBreadcrumb+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 92672BB529C9A2A9006B021C /* SentryBreadcrumb+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1105,6 +1104,8 @@
11051104
FA94E6912E6B92C100576666 /* SentryClientReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E68B2E6B92BE00576666 /* SentryClientReport.swift */; };
11061105
FA94E6B22E6D265800576666 /* SentryEnvelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E6B12E6D265500576666 /* SentryEnvelope.swift */; };
11071106
FA94E7242E6F339400576666 /* SentryEnvelopeItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA94E7232E6F32FA00576666 /* SentryEnvelopeItemType.swift */; };
1107+
FAA414532ED7615D00B269CD /* SentrySessionReplayHybridSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = FAA414502ED7608E00B269CD /* SentrySessionReplayHybridSDK.m */; };
1108+
FAA414542ED7616800B269CD /* SentrySessionReplayHybridSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = D80382BE2C09C6FD0090E048 /* SentrySessionReplayHybridSDK.h */; settings = {ATTRIBUTES = (Private, ); }; };
11081109
FAAB29F12E3D252300ACD577 /* SentrySession.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB29F02E3D252000ACD577 /* SentrySession.swift */; };
11091110
FAAB2EE02E4BE97500FE8B7E /* TestSentryNSApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB2EDF2E4BE96F00FE8B7E /* TestSentryNSApplication.swift */; };
11101111
FAAB2F972E4D345800FE8B7E /* SentryUIDeviceWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB2F962E4D344F00FE8B7E /* SentryUIDeviceWrapper.swift */; };
@@ -1309,7 +1310,7 @@
13091310
0A283E78291A67E000EF4126 /* SentryUIDeviceWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIDeviceWrapperTests.swift; sourceTree = "<group>"; };
13101311
0A2D7BB929152CBF008727AF /* SentryWatchdogTerminationScopeObserverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryWatchdogTerminationScopeObserverTests.swift; sourceTree = "<group>"; };
13111312
0A2D8D5A289815C0008720F6 /* SentryBaseIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryBaseIntegration.m; sourceTree = "<group>"; };
1312-
0A2D8D5C289815EB008720F6 /* SentryBaseIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryBaseIntegration.h; path = include/HybridPublic/SentryBaseIntegration.h; sourceTree = "<group>"; };
1313+
0A2D8D5C289815EB008720F6 /* SentryBaseIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryBaseIntegration.h; path = include/SentryBaseIntegration.h; sourceTree = "<group>"; };
13131314
0A2D8D8628992260008720F6 /* SentryBaseIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryBaseIntegrationTests.swift; sourceTree = "<group>"; };
13141315
0A2D8D9428997845008720F6 /* NSLocale+Sentry.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSLocale+Sentry.m"; sourceTree = "<group>"; };
13151316
0A2D8D9728997887008720F6 /* NSLocale+Sentry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "NSLocale+Sentry.h"; path = "include/NSLocale+Sentry.h"; sourceTree = "<group>"; };
@@ -2204,7 +2205,7 @@
22042205
D801990F286B089000C277F0 /* SentryCrashReportSinkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashReportSinkTests.swift; sourceTree = "<group>"; };
22052206
D802994D2BA836EF000F0081 /* SentryOnDemandReplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryOnDemandReplay.swift; sourceTree = "<group>"; };
22062207
D802994F2BA83A88000F0081 /* SentryPixelBuffer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryPixelBuffer.swift; sourceTree = "<group>"; };
2207-
D80382BE2C09C6FD0090E048 /* SentrySessionReplayIntegration-Hybrid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentrySessionReplayIntegration-Hybrid.h"; path = "include/HybridPublic/SentrySessionReplayIntegration-Hybrid.h"; sourceTree = "<group>"; };
2208+
D80382BE2C09C6FD0090E048 /* SentrySessionReplayHybridSDK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySessionReplayHybridSDK.h; path = include/HybridPublic/SentrySessionReplayHybridSDK.h; sourceTree = "<group>"; };
22082209
D80694C22B7CC86E00B820E6 /* SentryReplayEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryReplayEventTests.swift; sourceTree = "<group>"; };
22092210
D80694C52B7CCFA100B820E6 /* SentryReplayRecordingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryReplayRecordingTests.swift; sourceTree = "<group>"; };
22102211
D808FB86281AB31D009A2A33 /* SentryUIEventTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIEventTrackerTests.swift; sourceTree = "<group>"; };
@@ -2228,7 +2229,7 @@
22282229
D8199DD029377C130074249E /* SentrySwiftUI.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = SentrySwiftUI.podspec; sourceTree = "<group>"; };
22292230
D81A346B291AECC7005A27A9 /* PrivateSentrySDKOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PrivateSentrySDKOnly.h; path = include/HybridPublic/PrivateSentrySDKOnly.h; sourceTree = "<group>"; };
22302231
D81FDF10280EA0080045E0E4 /* SentryScreenshotSourceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryScreenshotSourceTests.swift; sourceTree = "<group>"; };
2231-
D820CDB52BB1895F00BA339D /* SentrySessionReplayIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySessionReplayIntegration.h; path = include/HybridPublic/SentrySessionReplayIntegration.h; sourceTree = "<group>"; };
2232+
D820CDB52BB1895F00BA339D /* SentrySessionReplayIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySessionReplayIntegration.h; path = include/SentrySessionReplayIntegration.h; sourceTree = "<group>"; };
22322233
D820CDB62BB1895F00BA339D /* SentrySessionReplayIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySessionReplayIntegration.m; sourceTree = "<group>"; };
22332234
D82859412C3E753C009A28AA /* SentrySessionReplaySyncC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySessionReplaySyncC.h; path = include/SentrySessionReplaySyncC.h; sourceTree = "<group>"; };
22342235
D82859422C3E753C009A28AA /* SentrySessionReplaySyncC.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SentrySessionReplaySyncC.c; sourceTree = "<group>"; };
@@ -2409,7 +2410,7 @@
24092410
F4FE9DFC2E622CD70014FED5 /* SentryObjCRuntimeWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryObjCRuntimeWrapper.swift; sourceTree = "<group>"; };
24102411
F4FE9E072E6248E40014FED5 /* SentryCrashWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashWrapper.swift; sourceTree = "<group>"; };
24112412
FA01BCB12E69352A00968DFA /* SentryDiscardedEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDiscardedEvent.swift; sourceTree = "<group>"; };
2412-
FA034AC72DD3DB4900FE3107 /* SentryIntegrationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryIntegrationProtocol.h; path = include/HybridPublic/SentryIntegrationProtocol.h; sourceTree = "<group>"; };
2413+
FA034AC72DD3DB4900FE3107 /* SentryIntegrationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryIntegrationProtocol.h; path = include/SentryIntegrationProtocol.h; sourceTree = "<group>"; };
24132414
FA18417D2E4B457B005DEDC7 /* SentryApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryApplication.swift; sourceTree = "<group>"; };
24142415
FA21A2E92E60E9C700E7EADB /* EnvelopeComparison.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvelopeComparison.swift; sourceTree = "<group>"; };
24152416
FA24E0292EBBF6F500EFD92E /* SentryOptionsObjC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryOptionsObjC.h; path = include/SentryOptionsObjC.h; sourceTree = "<group>"; };
@@ -2488,6 +2489,7 @@
24882489
FA94E68B2E6B92BE00576666 /* SentryClientReport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryClientReport.swift; sourceTree = "<group>"; };
24892490
FA94E6B12E6D265500576666 /* SentryEnvelope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelope.swift; sourceTree = "<group>"; };
24902491
FA94E7232E6F32FA00576666 /* SentryEnvelopeItemType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelopeItemType.swift; sourceTree = "<group>"; };
2492+
FAA414502ED7608E00B269CD /* SentrySessionReplayHybridSDK.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentrySessionReplayHybridSDK.m; sourceTree = "<group>"; };
24912493
FAAB29F02E3D252000ACD577 /* SentrySession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySession.swift; sourceTree = "<group>"; };
24922494
FAAB2EDF2E4BE96F00FE8B7E /* TestSentryNSApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryNSApplication.swift; sourceTree = "<group>"; };
24932495
FAAB2F962E4D344F00FE8B7E /* SentryUIDeviceWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIDeviceWrapper.swift; sourceTree = "<group>"; };
@@ -4521,7 +4523,8 @@
45214523
isa = PBXGroup;
45224524
children = (
45234525
D820CDB52BB1895F00BA339D /* SentrySessionReplayIntegration.h */,
4524-
D80382BE2C09C6FD0090E048 /* SentrySessionReplayIntegration-Hybrid.h */,
4526+
D80382BE2C09C6FD0090E048 /* SentrySessionReplayHybridSDK.h */,
4527+
FAA414502ED7608E00B269CD /* SentrySessionReplayHybridSDK.m */,
45254528
D8AFC0612BDBEDF100118BE1 /* SentrySessionReplayIntegration+Private.h */,
45264529
D820CDB62BB1895F00BA339D /* SentrySessionReplayIntegration.m */,
45274530
D82859412C3E753C009A28AA /* SentrySessionReplaySyncC.h */,
@@ -5129,7 +5132,6 @@
51295132
8EAE980C261E9F530073B6B3 /* SentryDefaultUIViewControllerPerformanceTracker.h in Headers */,
51305133
63FE717D20DA4C1100CDBAE8 /* SentryCrashCachedData.h in Headers */,
51315134
03BCC38A27E1BF49003232C7 /* SentryTime.h in Headers */,
5132-
925824C22CB5897700C9B20B /* SentrySessionReplayIntegration-Hybrid.h in Headers */,
51335135
63FE70CD20DA4C1000CDBAE8 /* SentryCrashDoctor.h in Headers */,
51345136
7B6438AA26A70F24000D0F65 /* UIViewController+Sentry.h in Headers */,
51355137
33EB2A912C3412E4004FED3D /* SentryWithoutUIKit.h in Headers */,
@@ -5253,6 +5255,7 @@
52535255
FA034AC82DD3DB4900FE3107 /* SentryIntegrationProtocol.h in Headers */,
52545256
63FE715720DA4C1100CDBAE8 /* SentryCrashThread.h in Headers */,
52555257
62E59A532E8FB70000DB7A7B /* SentryTracePropagation.h in Headers */,
5258+
FAA414542ED7616800B269CD /* SentrySessionReplayHybridSDK.h in Headers */,
52565259
7BF9EF862722D10600B5BBEF /* SentryTestObjCRuntimeWrapper.h in Headers */,
52575260
63FE718B20DA4C1100CDBAE8 /* SentryCrashReport.h in Headers */,
52585261
7D0FCFB22379B915004DD83A /* SentryHub.h in Headers */,
@@ -5738,6 +5741,7 @@
57385741
isa = PBXSourcesBuildPhase;
57395742
buildActionMask = 2147483647;
57405743
files = (
5744+
FAA414532ED7615D00B269CD /* SentrySessionReplayHybridSDK.m in Sources */,
57415745
F4763A072EB3AC370006DF1E /* SentryThreadInspector.swift in Sources */,
57425746
7BFC16A125249A9D00FF6266 /* SentryMessage.m in Sources */,
57435747
FA90FAFD2E070A3B008CAAE8 /* SentryURLRequestFactory.swift in Sources */,

Sources/Resources/Sentry.modulemap

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ framework module Sentry {
1616
header "SentrySwizzle.h"
1717
header "SentryUser+Private.h"
1818

19-
header "SentryIntegrationProtocol.h"
20-
header "SentryBaseIntegration.h"
21-
header "SentrySessionReplayIntegration.h"
22-
header "SentrySessionReplayIntegration-Hybrid.h"
19+
header "SentrySessionReplayHybridSDK.h"
2320

2421
header "SentryInternalSerializable.h"
2522

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#import "SentrySessionReplayHybridSDK.h"
2+
3+
#if SENTRY_TARGET_REPLAY_SUPPORTED
4+
5+
# import "SentryLogC.h"
6+
# import "SentrySwift.h"
7+
8+
@implementation SentrySessionReplayHybridSDK
9+
10+
+ (id<SentryRRWebEvent>)createBreadcrumbwithTimestamp:(NSDate *)timestamp
11+
category:(NSString *)category
12+
message:(nullable NSString *)message
13+
level:(SentryLevel)level
14+
data:(nullable NSDictionary<NSString *, id> *)data
15+
{
16+
SENTRY_LOG_DEBUG(@"[Session Replay] Creating breadcrumb with timestamp: %@, category: %@, "
17+
@"message: %@, level: %lu, data: %@",
18+
timestamp, category, message, level, data);
19+
return [[SentryRRWebBreadcrumbEvent alloc] initWithTimestamp:timestamp
20+
category:category
21+
message:message
22+
level:level
23+
data:data];
24+
}
25+
26+
+ (id<SentryRRWebEvent>)createNetworkBreadcrumbWithTimestamp:(NSDate *)timestamp
27+
endTimestamp:(NSDate *)endTimestamp
28+
operation:(NSString *)operation
29+
description:(NSString *)description
30+
data:(NSDictionary<NSString *, id> *)data
31+
{
32+
SENTRY_LOG_DEBUG(@"[Session Replay] Creating network breadcrumb with timestamp: %@, "
33+
@"endTimestamp: %@, operation: %@, description: %@, data: %@",
34+
timestamp, endTimestamp, operation, description, data);
35+
return [[SentryRRWebSpanEvent alloc] initWithTimestamp:timestamp
36+
endTimestamp:endTimestamp
37+
operation:operation
38+
description:description
39+
data:data];
40+
}
41+
42+
+ (id<SentryReplayBreadcrumbConverter>)createDefaultBreadcrumbConverter
43+
{
44+
SENTRY_LOG_DEBUG(@"[Session Replay] Creating default breadcrumb converter");
45+
return [[SentrySRDefaultBreadcrumbConverter alloc] init];
46+
}
47+
48+
@end
49+
50+
#endif

Sources/Sentry/SentrySessionReplayIntegration.m

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -717,44 +717,6 @@ - (SentryTouchTracker *)getTouchTracker
717717
}
718718
# endif
719719

720-
+ (id<SentryRRWebEvent>)createBreadcrumbwithTimestamp:(NSDate *)timestamp
721-
category:(NSString *)category
722-
message:(nullable NSString *)message
723-
level:(SentryLevel)level
724-
data:(nullable NSDictionary<NSString *, id> *)data
725-
{
726-
SENTRY_LOG_DEBUG(@"[Session Replay] Creating breadcrumb with timestamp: %@, category: %@, "
727-
@"message: %@, level: %lu, data: %@",
728-
timestamp, category, message, level, data);
729-
return [[SentryRRWebBreadcrumbEvent alloc] initWithTimestamp:timestamp
730-
category:category
731-
message:message
732-
level:level
733-
data:data];
734-
}
735-
736-
+ (id<SentryRRWebEvent>)createNetworkBreadcrumbWithTimestamp:(NSDate *)timestamp
737-
endTimestamp:(NSDate *)endTimestamp
738-
operation:(NSString *)operation
739-
description:(NSString *)description
740-
data:(NSDictionary<NSString *, id> *)data
741-
{
742-
SENTRY_LOG_DEBUG(@"[Session Replay] Creating network breadcrumb with timestamp: %@, "
743-
@"endTimestamp: %@, operation: %@, description: %@, data: %@",
744-
timestamp, endTimestamp, operation, description, data);
745-
return [[SentryRRWebSpanEvent alloc] initWithTimestamp:timestamp
746-
endTimestamp:endTimestamp
747-
operation:operation
748-
description:description
749-
data:data];
750-
}
751-
752-
+ (id<SentryReplayBreadcrumbConverter>)createDefaultBreadcrumbConverter
753-
{
754-
SENTRY_LOG_DEBUG(@"[Session Replay] Creating default breadcrumb converter");
755-
return [[SentrySRDefaultBreadcrumbConverter alloc] init];
756-
}
757-
758720
# pragma mark - SessionReplayDelegate
759721

760722
- (BOOL)sessionReplayShouldCaptureReplayForError

Sources/Sentry/include/HybridPublic/SentrySessionReplayIntegration-Hybrid.h renamed to Sources/Sentry/include/HybridPublic/SentrySessionReplayHybridSDK.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
# import "SentryDefines.h"
55
#endif
66

7-
#if __has_include(<Sentry/SentrySessionReplayIntegration.h>)
8-
# import <Sentry/SentrySessionReplayIntegration.h>
9-
#else
10-
# import "SentrySessionReplayIntegration.h"
11-
#endif
127
#if __has_include(<Sentry/SentryLevel.h>)
138
# import <Sentry/SentryLevel.h>
149
#else
@@ -23,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
2318
@protocol SentryReplayBreadcrumbConverter;
2419
@protocol SentryRRWebEvent;
2520

26-
@interface SentrySessionReplayIntegration ()
21+
@interface SentrySessionReplayHybridSDK : NSObject
2722

2823
+ (id<SentryRRWebEvent>)createBreadcrumbwithTimestamp:(NSDate *)timestamp
2924
category:(NSString *)category

Tests/SentryTests/SentryTests-Bridging-Header.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#import "SentryDefines.h"
22

3+
#import "SentryLaunchProfiling+Tests.h"
4+
35
#if SENTRY_HAS_METRIC_KIT
46
# import "SentryMetricKitIntegration.h"
57
#endif // SENTRY_HAS_METRIC_KIT
@@ -20,7 +22,6 @@
2022
#if SENTRY_TARGET_PROFILING_SUPPORTED
2123
# import "SentryContinuousProfiler+Test.h"
2224
# import "SentryContinuousProfiler.h"
23-
# import "SentryLaunchProfiling+Tests.h"
2425
# import "SentryMetricProfiler.h"
2526
# import "SentryProfiler+Private.h"
2627
# import "SentryProfilerDefines.h"

0 commit comments

Comments
 (0)