Skip to content

Commit 3b3560f

Browse files
committed
Convert SentryEnvelopeHeader to Swift
1 parent d0f9518 commit 3b3560f

File tree

11 files changed

+214
-328
lines changed

11 files changed

+214
-328
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,6 @@
460460
7B8713B426415BAA006D6004 /* SentryAppStartTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B8713B326415BAA006D6004 /* SentryAppStartTracker.m */; };
461461
7B87C916295ECFD700510C52 /* SentryMetricKitEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B87C915295ECFD700510C52 /* SentryMetricKitEventTests.swift */; };
462462
7B883F49253D714C00879E62 /* SentryCrashUUIDConversion.c in Sources */ = {isa = PBXBuildFile; fileRef = 7B883F48253D714C00879E62 /* SentryCrashUUIDConversion.c */; };
463-
7B88F2FE24BC5A4C00ADF90A /* SentrySdkInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B88F2FD24BC5A4C00ADF90A /* SentrySdkInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
464-
7B88F30024BC5A7D00ADF90A /* SentrySdkInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B88F2FF24BC5A7D00ADF90A /* SentrySdkInfo.m */; };
465463
7B88F30224BC5C6D00ADF90A /* SentrySdkInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B88F30124BC5C6D00ADF90A /* SentrySdkInfoTests.swift */; };
466464
7B88F30424BC8E6500ADF90A /* SentrySerializationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B88F30324BC8E6500ADF90A /* SentrySerializationTests.swift */; };
467465
7B8CA85726DD4E6200DD872C /* SentryNetworkTrackerIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B8CA85626DD4E6200DD872C /* SentryNetworkTrackerIntegrationTests.swift */; };
@@ -1063,8 +1061,10 @@
10631061
FA67DD182DDBD4EA00896B02 /* UIImageHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA67DCED2DDBD4EA00896B02 /* UIImageHelper.swift */; };
10641062
FA67DD192DDBD4EA00896B02 /* SwizzleClassNameExclude.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA67DCD52DDBD4EA00896B02 /* SwizzleClassNameExclude.swift */; };
10651063
FA8A36182DEAA1EB0058D883 /* SentryThread+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */; };
1064+
FA90FAA62E065A47008CAAE8 /* SentryEnvelopeHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAA52E065A43008CAAE8 /* SentryEnvelopeHeader.swift */; };
10661065
FA90FAA82E06614E008CAAE8 /* SentryExtraPackages.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */; };
10671066
FA90FAF72E06E427008CAAE8 /* SentrySdkPackage.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAF62E06E427008CAAE8 /* SentrySdkPackage.swift */; };
1067+
FA90FAF92E06E667008CAAE8 /* SentrySdkInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAF82E06E664008CAAE8 /* SentrySdkInfo.swift */; };
10681068
FAEC270E2DF3526000878871 /* SentryUserFeedback.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */; };
10691069
FAEC273D2DF3933A00878871 /* NSData+Unzip.m in Sources */ = {isa = PBXBuildFile; fileRef = FAEC273C2DF3933200878871 /* NSData+Unzip.m */; };
10701070
/* End PBXBuildFile section */
@@ -1631,8 +1631,6 @@
16311631
7B8713B326415BAA006D6004 /* SentryAppStartTracker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryAppStartTracker.m; sourceTree = "<group>"; };
16321632
7B87C915295ECFD700510C52 /* SentryMetricKitEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryMetricKitEventTests.swift; sourceTree = "<group>"; };
16331633
7B883F48253D714C00879E62 /* SentryCrashUUIDConversion.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SentryCrashUUIDConversion.c; sourceTree = "<group>"; };
1634-
7B88F2FD24BC5A4C00ADF90A /* SentrySdkInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySdkInfo.h; path = include/SentrySdkInfo.h; sourceTree = "<group>"; };
1635-
7B88F2FF24BC5A7D00ADF90A /* SentrySdkInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySdkInfo.m; sourceTree = "<group>"; };
16361634
7B88F30124BC5C6D00ADF90A /* SentrySdkInfoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySdkInfoTests.swift; sourceTree = "<group>"; };
16371635
7B88F30324BC8E6500ADF90A /* SentrySerializationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySerializationTests.swift; sourceTree = "<group>"; };
16381636
7B8CA85626DD4E6200DD872C /* SentryNetworkTrackerIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNetworkTrackerIntegrationTests.swift; sourceTree = "<group>"; };
@@ -2308,8 +2306,10 @@
23082306
FA67DCEF2DDBD4EA00896B02 /* URLSessionTaskHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionTaskHelper.swift; sourceTree = "<group>"; };
23092307
FA67DCF22DDBD4EA00896B02 /* SwiftDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftDescriptor.swift; sourceTree = "<group>"; };
23102308
FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryThread+Private.h"; path = "include/SentryThread+Private.h"; sourceTree = "<group>"; };
2309+
FA90FAA52E065A43008CAAE8 /* SentryEnvelopeHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelopeHeader.swift; sourceTree = "<group>"; };
23112310
FA90FAA72E06614B008CAAE8 /* SentryExtraPackages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExtraPackages.swift; sourceTree = "<group>"; };
23122311
FA90FAF62E06E427008CAAE8 /* SentrySdkPackage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySdkPackage.swift; sourceTree = "<group>"; };
2312+
FA90FAF82E06E664008CAAE8 /* SentrySdkInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySdkInfo.swift; sourceTree = "<group>"; };
23132313
FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUserFeedback.swift; sourceTree = "<group>"; };
23142314
FAEC273C2DF3933200878871 /* NSData+Unzip.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+Unzip.m"; sourceTree = "<group>"; };
23152315
FAEC273E2DF393E000878871 /* NSData+Unzip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Unzip.h"; sourceTree = "<group>"; };
@@ -2444,6 +2444,7 @@
24442444
621D9F2D2B9B030E003D94DE /* Helper */ = {
24452445
isa = PBXGroup;
24462446
children = (
2447+
FA90FAF82E06E664008CAAE8 /* SentrySdkInfo.swift */,
24472448
FA90FAF62E06E427008CAAE8 /* SentrySdkPackage.swift */,
24482449
84B0E0062CD963F9007FB332 /* SentryIconography.swift */,
24492450
621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */,
@@ -2560,8 +2561,6 @@
25602561
7B4E24FB251C97B400060D68 /* SentrySession.h */,
25612562
15E0A8F12411A45A00F044E3 /* SentrySession.m */,
25622563
7BE1E32624F7AE08009D3AD0 /* SentrySession+Private.h */,
2563-
7B88F2FD24BC5A4C00ADF90A /* SentrySdkInfo.h */,
2564-
7B88F2FF24BC5A7D00ADF90A /* SentrySdkInfo.m */,
25652564
7BFC169A2524995700FF6266 /* SentryMessage.h */,
25662565
7BFC16A025249A9D00FF6266 /* SentryMessage.m */,
25672566
7B4E375425822C4500059C93 /* SentryAttachment.h */,
@@ -4238,6 +4237,7 @@
42384237
D856272A2A374A6800FB8062 /* Tools */ = {
42394238
isa = PBXGroup;
42404239
children = (
4240+
FA90FAA52E065A43008CAAE8 /* SentryEnvelopeHeader.swift */,
42414241
FA67DCC02DDBD4C800896B02 /* SentryLog+Configure.swift */,
42424242
);
42434243
path = Tools;
@@ -4625,7 +4625,6 @@
46254625
63FE717720DA4C1100CDBAE8 /* SentryCrashReportWriter.h in Headers */,
46264626
84DEE86B2B686BD400A7BC17 /* SentrySamplerDecision.h in Headers */,
46274627
7B4E23BE251A2BD500060D68 /* SentryCrashIntegrationSessionHandler.h in Headers */,
4628-
7B88F2FE24BC5A4C00ADF90A /* SentrySdkInfo.h in Headers */,
46294628
D4291A692DD61A3F00772088 /* SentryDispatchQueueProviderProtocol.h in Headers */,
46304629
7BCFBD672681C95000BC27D8 /* SentryScopeObserver.h in Headers */,
46314630
D81A346C291AECC7005A27A9 /* PrivateSentrySDKOnly.h in Headers */,
@@ -5287,6 +5286,7 @@
52875286
15E0A8ED240F2CB000F044E3 /* SentrySerialization.m in Sources */,
52885287
7BC85235245880AE005A70F0 /* SentryDataCategoryMapper.m in Sources */,
52895288
7B7A30C824B48389005A4C6E /* SentryCrashWrapper.m in Sources */,
5289+
FA90FAA62E065A47008CAAE8 /* SentryEnvelopeHeader.swift in Sources */,
52905290
D8ACE3C92762187200F5A213 /* SentryFileIOTrackingIntegration.m in Sources */,
52915291
620078742D38F0DF0022CB67 /* SentryCodable.swift in Sources */,
52925292
F45243892DE65968003E8F50 /* ExceptionCatcher.m in Sources */,
@@ -5299,7 +5299,6 @@
52995299
7BA0C0482805600A003E0326 /* SentryTransportAdapter.m in Sources */,
53005300
63FE712920DA4C1000CDBAE8 /* SentryCrashCPU_arm.c in Sources */,
53015301
03F84D3427DD4191008FE43F /* SentryThreadMetadataCache.cpp in Sources */,
5302-
7B88F30024BC5A7D00ADF90A /* SentrySdkInfo.m in Sources */,
53035302
62862B1E2B1DDC35009B16E3 /* SentryDelayedFrame.m in Sources */,
53045303
84AC61D729F75A98009EEF61 /* SentryDispatchFactory.m in Sources */,
53055304
15360CD62432832400112302 /* SentryAutoSessionTrackingIntegration.m in Sources */,
@@ -5580,6 +5579,7 @@
55805579
63FE714520DA4C1100CDBAE8 /* SentryCrashObjC.c in Sources */,
55815580
63FE710520DA4C1000CDBAE8 /* SentryAsyncSafeLog.c in Sources */,
55825581
62E300942D5202890037AA3F /* SentryExceptionCodable.swift in Sources */,
5582+
FA90FAF92E06E667008CAAE8 /* SentrySdkInfo.swift in Sources */,
55835583
0A2D8D5B289815C0008720F6 /* SentryBaseIntegration.m in Sources */,
55845584
639FCF991EBC7B9700778193 /* SentryEvent.m in Sources */,
55855585
D820CDB72BB1895F00BA339D /* SentrySessionReplayIntegration.m in Sources */,

Sources/Resources/Sentry.modulemap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ framework module Sentry {
2626
header "SentrySessionReplayIntegration.h"
2727
header "SentrySessionReplayIntegration-Hybrid.h"
2828

29-
header "SentrySdkInfo.h"
3029
header "SentryInternalSerializable.h"
3130

3231
export *

Sources/Sentry/SentryClient.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#import "SentryRandom.h"
3434
#import "SentrySDK+Private.h"
3535
#import "SentryScope+Private.h"
36-
#import "SentrySdkInfo.h"
3736
#import "SentrySerialization.h"
3837
#import "SentrySession.h"
3938
#import "SentryStacktraceBuilder.h"

Sources/Sentry/SentryEnvelope.m

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,13 @@
99
#import "SentryLog.h"
1010
#import "SentryMessage.h"
1111
#import "SentryMsgPackSerializer.h"
12-
#import "SentrySdkInfo.h"
1312
#import "SentrySerialization.h"
1413
#import "SentrySession.h"
1514
#import "SentrySwift.h"
1615
#import "SentryTransaction.h"
1716

1817
NS_ASSUME_NONNULL_BEGIN
1918

20-
@implementation SentryEnvelopeHeader
21-
22-
// id can be null if no event in the envelope or attachment related to event
23-
- (instancetype)initWithId:(SentryId *_Nullable)eventId
24-
{
25-
self = [self initWithId:eventId traceContext:nil];
26-
return self;
27-
}
28-
29-
- (instancetype)initWithId:(nullable SentryId *)eventId
30-
traceContext:(nullable SentryTraceContext *)traceContext
31-
{
32-
SentrySdkInfo *sdkInfo = [SentrySdkInfo global];
33-
self = [self initWithId:eventId sdkInfo:sdkInfo traceContext:traceContext];
34-
return self;
35-
}
36-
37-
- (instancetype)initWithId:(nullable SentryId *)eventId
38-
sdkInfo:(nullable SentrySdkInfo *)sdkInfo
39-
traceContext:(nullable SentryTraceContext *)traceContext
40-
{
41-
if (self = [super init]) {
42-
_eventId = eventId;
43-
_sdkInfo = sdkInfo;
44-
_traceContext = traceContext;
45-
}
46-
47-
return self;
48-
}
49-
50-
+ (instancetype)empty
51-
{
52-
return [[SentryEnvelopeHeader alloc] initWithId:nil traceContext:nil];
53-
}
54-
55-
@end
56-
5719
@implementation SentryEnvelopeItem
5820

5921
- (instancetype)initWithHeader:(SentryEnvelopeItemHeader *)header data:(NSData *)data

Sources/Sentry/SentrySdkInfo.m

Lines changed: 0 additions & 130 deletions
This file was deleted.

Sources/Sentry/SentrySerialization.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#import "SentryError.h"
88
#import "SentryLevelMapper.h"
99
#import "SentryLog.h"
10-
#import "SentrySdkInfo.h"
1110
#import "SentrySession.h"
1211
#import "SentrySwift.h"
1312
#import "SentryTraceContext.h"

Sources/Sentry/include/HybridPublic/SentryEnvelope.h

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

7-
#if COCOAPODS
8-
@class SentrySdkInfo;
9-
#else
10-
11-
# if __has_include(<Sentry/SentrySdkInfo.h>)
12-
# import <Sentry/SentrySdkInfo.h>
13-
# else
14-
# import "SentrySdkInfo.h"
15-
# endif
16-
17-
#endif
18-
197
@class SentryAttachment;
208
@class SentryEnvelopeItemHeader;
219
@class SentryEvent;
@@ -24,68 +12,10 @@
2412
@class SentrySession;
2513
@class SentryTraceContext;
2614
@class SentryUserFeedback;
15+
@class SentryEnvelopeHeader;
2716

2817
NS_ASSUME_NONNULL_BEGIN
2918

30-
@interface SentryEnvelopeHeader : NSObject
31-
SENTRY_NO_INIT
32-
33-
/**
34-
* Initializes an @c SentryEnvelopeHeader object with the specified eventId.
35-
* @note Sets the @c sdkInfo from @c SentryMeta.
36-
* @param eventId The identifier of the event. Can be nil if no event in the envelope or attachment
37-
* related to event.
38-
*/
39-
- (instancetype)initWithId:(SentryId *_Nullable)eventId;
40-
41-
/**
42-
* Initializes a @c SentryEnvelopeHeader object with the specified @c eventId and @c traceContext.
43-
* @param eventId The identifier of the event. Can be @c nil if no event in the envelope or
44-
* attachment related to event.
45-
* @param traceContext Current trace state.
46-
*/
47-
- (instancetype)initWithId:(nullable SentryId *)eventId
48-
traceContext:(nullable SentryTraceContext *)traceContext;
49-
50-
/**
51-
* Initializes a @c SentryEnvelopeHeader object with the specified @c eventId, @c skdInfo and
52-
* @c traceContext. It is recommended to use @c initWithId:traceContext: because it sets the
53-
* @c sdkInfo for you.
54-
* @param eventId The identifier of the event. Can be @c nil if no event in the envelope or
55-
* attachment related to event.
56-
* @param sdkInfo Describes the Sentry SDK. Can be @c nil for backwards compatibility. New
57-
* instances should always provide a version.
58-
* @param traceContext Current trace state.
59-
*/
60-
- (instancetype)initWithId:(nullable SentryId *)eventId
61-
sdkInfo:(nullable SentrySdkInfo *)sdkInfo
62-
traceContext:(nullable SentryTraceContext *)traceContext NS_DESIGNATED_INITIALIZER;
63-
64-
/**
65-
* The event identifier, if available.
66-
* An event id exist if the envelope contains an event of items within it are related. i.e
67-
* Attachments
68-
*/
69-
@property (nullable, nonatomic, readonly, copy) SentryId *eventId;
70-
71-
@property (nullable, nonatomic, readonly, copy) SentrySdkInfo *sdkInfo;
72-
73-
@property (nullable, nonatomic, readonly, copy) SentryTraceContext *traceContext;
74-
75-
/**
76-
* The timestamp when the event was sent from the SDK as string in RFC 3339 format. Used
77-
* for clock drift correction of the event timestamp. The time zone must be UTC.
78-
*
79-
* The timestamp should be generated as close as possible to the transmision of the event,
80-
* so that the delay between sending the envelope and receiving it on the server-side is
81-
* minimized.
82-
*/
83-
@property (nullable, nonatomic, copy) NSDate *sentAt;
84-
85-
+ (instancetype)empty;
86-
87-
@end
88-
8919
@interface SentryEnvelopeItem : NSObject
9020
SENTRY_NO_INIT
9121

0 commit comments

Comments
 (0)