Skip to content

Commit c3d6cfa

Browse files
authored
chore: Remove more codable v9 checks (#6363)
1 parent 80538ca commit c3d6cfa

29 files changed

+47
-177
lines changed

Sources/Sentry/Public/SentryThread.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,12 @@ NS_ASSUME_NONNULL_BEGIN
2020

2121
SENTRY_NO_INIT
2222

23-
#if SDK_V9
2423
/**
2524
* Number of the thread.
2625
*
2726
* Can be nil for threads in recrash reports where the thread index information is not available.
2827
*/
2928
@property (nullable, nonatomic, copy) NSNumber *threadId;
30-
#else
31-
/**
32-
* Number of the thread
33-
*/
34-
@property (nonatomic, copy) NSNumber *threadId;
35-
#endif // SDK_V9
3629

3730
/**
3831
* Name (if available) of the thread
@@ -59,21 +52,12 @@ SENTRY_NO_INIT
5952
*/
6053
@property (nullable, nonatomic, copy) NSNumber *isMain;
6154

62-
#if SDK_V9
6355
/**
6456
* Initializes a SentryThread with its id
6557
* @param threadId NSNumber or nil if thread index is not available (e.g., recrash reports)
6658
* @return SentryThread
6759
*/
6860
- (instancetype)initWithThreadId:(nullable NSNumber *)threadId;
69-
#else
70-
/**
71-
* Initializes a SentryThread with its id
72-
* @param threadId NSNumber
73-
* @return SentryThread
74-
*/
75-
- (instancetype)initWithThreadId:(NSNumber *)threadId;
76-
#endif // SDK_V9
7761

7862
@end
7963

Sources/Sentry/SentryBreadcrumb.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ - (BOOL)isEqual:(id _Nullable)other
7777
{
7878
if (other == self)
7979
return YES;
80-
if (!other || ![[other class] isEqual:[self class]])
80+
if (!other || ![other isKindOfClass:[SentryBreadcrumb class]])
8181
return NO;
8282

8383
return [self isEqualToBreadcrumb:SENTRY_UNWRAP_NULLABLE(SentryBreadcrumb, other)];

Sources/Sentry/SentryGeo.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ - (BOOL)isEqual:(id _Nullable)other
4343
if (other == self) {
4444
return YES;
4545
}
46-
if (!other || ![[other class] isEqual:[self class]]) {
46+
if (!other || ![other isKindOfClass:[SentryGeo class]]) {
4747
return NO;
4848
}
4949

Sources/Sentry/SentryThread.mm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212

1313
@implementation SentryThread
1414

15-
#if SDK_V9
1615
- (instancetype)initWithThreadId:(nullable NSNumber *)threadId
17-
#else
18-
- (instancetype)initWithThreadId:(NSNumber *)threadId
19-
#endif // SDK_V9
2016
{
2117
self = [super init];
2218
if (self) {

Sources/Swift/Protocol/Codable/SentryBreadcrumbCodable.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
@_implementationOnly import _SentryPrivate
22
import Foundation
33

4-
#if SDK_V9
54
final class BreadcrumbDecodable: Breadcrumb {
65
convenience public init(from decoder: any Decoder) throws {
76
try self.init(decodedFrom: decoder)
87
}
98
}
10-
#else
11-
typealias BreadcrumbDecodable = Breadcrumb
12-
#endif
9+
1310
extension BreadcrumbDecodable: Decodable {
1411

1512
private enum CodingKeys: String, CodingKey {
@@ -21,12 +18,6 @@ extension BreadcrumbDecodable: Decodable {
2118
case data
2219
case origin
2320
}
24-
25-
#if !SDK_V9
26-
required convenience public init(from decoder: any Decoder) throws {
27-
try self.init(decodedFrom: decoder)
28-
}
29-
#endif
3021

3122
private convenience init(decodedFrom decoder: Decoder) throws {
3223
let container = try decoder.container(keyedBy: CodingKeys.self)

Sources/Swift/Protocol/Codable/SentryEventCodable.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,13 @@ import Foundation
1616
* overridden. Therefore, we add the Decodable implementation not on the Event, but to a subclass of
1717
* the event.
1818
*/
19-
#if !SDK_V9
20-
@objc(SentryEventDecodable)
21-
open class SentryEventDecodable: Event, Decodable {
22-
required convenience public init(from decoder: any Decoder) throws {
23-
let container = try decoder.container(keyedBy: CodingKeys.self)
24-
self.init()
25-
try writePropertiesFrom(container: container)
26-
}
27-
}
28-
#else
2919
final class SentryEventDecodable: Event, Decodable {
3020
required convenience public init(from decoder: any Decoder) throws {
3121
let container = try decoder.container(keyedBy: CodingKeys.self)
3222
self.init()
3323
try writePropertiesFrom(container: container)
3424
}
3525
}
36-
#endif
3726

3827
extension SentryEventDecodable {
3928
private enum CodingKeys: String, CodingKey {

Sources/Swift/Protocol/Codable/SentryExceptionCodable.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
@_implementationOnly import _SentryPrivate
22
import Foundation
33

4-
#if SDK_V9
54
final class ExceptionDecodable: Exception {
65
convenience public init(from decoder: any Decoder) throws {
76
try self.init(decodedFrom: decoder)
87
}
98
}
10-
#else
11-
typealias ExceptionDecodable = Exception
12-
#endif
9+
1310
extension ExceptionDecodable: Decodable {
1411

1512
private enum CodingKeys: String, CodingKey {
@@ -21,12 +18,6 @@ extension ExceptionDecodable: Decodable {
2118
case stacktrace
2219
}
2320

24-
#if !SDK_V9
25-
required convenience public init(from decoder: any Decoder) throws {
26-
try self.init(decodedFrom: decoder)
27-
}
28-
#endif
29-
3021
private convenience init(decodedFrom decoder: Decoder) throws {
3122
let container = try decoder.container(keyedBy: CodingKeys.self)
3223

Sources/Swift/Protocol/Codable/SentryFrameCodable.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
@_implementationOnly import _SentryPrivate
22
import Foundation
33

4-
#if SDK_V9
54
final class FrameDecodable: Frame {
65
convenience public init(from decoder: any Decoder) throws {
76
try self.init(decodedFrom: decoder)
87
}
98
}
10-
#else
11-
typealias FrameDecodable = Frame
12-
#endif
9+
1310
extension FrameDecodable: Decodable {
1411

1512
enum CodingKeys: String, CodingKey {
@@ -35,12 +32,6 @@ extension FrameDecodable: Decodable {
3532
case stackStart = "stack_start"
3633
}
3734

38-
#if !SDK_V9
39-
required convenience public init(from decoder: any Decoder) throws {
40-
try self.init(decodedFrom: decoder)
41-
}
42-
#endif
43-
4435
private convenience init(decodedFrom decoder: Decoder) throws {
4536
self.init()
4637

Sources/Swift/Protocol/Codable/SentryGeoCodable.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
@_implementationOnly import _SentryPrivate
22
import Foundation
33

4-
#if SDK_V9
54
final class GeoDecodable: Geo {
65
convenience public init(from decoder: any Decoder) throws {
76
try self.init(decodedFrom: decoder)
87
}
98
}
10-
#else
11-
typealias GeoDecodable = Geo
12-
#endif
9+
1310
extension GeoDecodable: Decodable {
1411

1512
private enum CodingKeys: String, CodingKey {
1613
case city
1714
case countryCode = "country_code"
1815
case region
1916
}
20-
21-
#if !SDK_V9
22-
required convenience public init(from decoder: any Decoder) throws {
23-
try self.init(decodedFrom: decoder)
24-
}
25-
#endif
2617

2718
private convenience init(decodedFrom decoder: Decoder) throws {
2819
let container = try decoder.container(keyedBy: CodingKeys.self)

Sources/Swift/Protocol/Codable/SentryMechanismCodable.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
@_implementationOnly import _SentryPrivate
22
import Foundation
33

4-
#if SDK_V9
54
final class MechanismDecodable: Mechanism {
65
convenience public init(from decoder: any Decoder) throws {
76
try self.init(decodedFrom: decoder)
87
}
98
}
10-
#else
11-
typealias MechanismDecodable = Mechanism
12-
#endif
9+
1310
extension MechanismDecodable: Decodable {
1411

1512
enum CodingKeys: String, CodingKey {
@@ -21,12 +18,6 @@ extension MechanismDecodable: Decodable {
2118
case helpLink = "help_link"
2219
case meta
2320
}
24-
25-
#if !SDK_V9
26-
required convenience public init(from decoder: any Decoder) throws {
27-
try self.init(decodedFrom: decoder)
28-
}
29-
#endif
3021

3122
private convenience init(decodedFrom decoder: Decoder) throws {
3223
let container = try decoder.container(keyedBy: CodingKeys.self)

0 commit comments

Comments
 (0)