Skip to content

Commit 78af7a9

Browse files
authored
chore: Some decodable updates for V9 (#6357)
1 parent 7aaa0b6 commit 78af7a9

File tree

6 files changed

+8
-18
lines changed

6 files changed

+8
-18
lines changed

CHANGELOG-v9.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Removes deprecated SentryDebugImageProvider class (#5598)
99
Makes app hang tracking V2 the default and removes the option to enable/disable it (#5615)
1010
Removes segment property on SentryUser, SentryBaggage, and SentryTraceContext (#5638)
1111
Removes public SentrySerializable conformance from many public models (#5636, #5840, #5982)
12-
Removes Decodable conformances from the public API of model classes (#5691)
1312
Removes enableTracing property from SentryOptions (#5694)
1413
Removes deprecated `setExtraValue` from SentrySpan (#5864)
1514
Removes `integrations` property from `SentryOptions` (#5749)

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
### Breaking Changes
66

7-
Removes deprecated user feedback API, this is replaced with the new feedback API (#5591)
8-
Removes `enablePerformanceV2` option and makes this the default. The app start duration will now finish when the first frame is drawn instead of when the OS posts the UIWindowDidBecomeVisibleNotification. (#6008)
7+
- Removes Decodable conformances from the public API of model classes (#5691)
8+
- Removes deprecated user feedback API, this is replaced with the new feedback API (#5591)
9+
- Removes `enablePerformanceV2` option and makes this the default. The app start duration will now finish when the first frame is drawn instead of when the OS posts the UIWindowDidBecomeVisibleNotification. (#6008)
910

1011
### Features
1112

Sources/Sentry/SentryUser.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ - (BOOL)isEqual:(id _Nullable)other
122122
if (other == self) {
123123
return YES;
124124
}
125-
if (!other || ![[other class] isEqual:[self class]]) {
125+
if (!other || ![other isKindOfClass:[SentryUser class]]) {
126126
return NO;
127127
}
128128

Sources/Swift/Protocol/Codable/SentryUserCodable.swift

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

4-
#if SDK_V9
54
final class UserDecodable: User {
65
@available(*, deprecated)
76
convenience public init(from decoder: any Decoder) throws {
87
try self.init(decodedFrom: decoder)
98
}
109
}
11-
#else
12-
typealias UserDecodable = User
13-
#endif
10+
1411
extension UserDecodable: Decodable {
1512

1613
enum CodingKeys: String, CodingKey {
@@ -24,13 +21,6 @@ extension UserDecodable: Decodable {
2421
case data
2522
}
2623

27-
#if !SDK_V9
28-
@available(*, deprecated)
29-
required convenience public init(from decoder: any Decoder) throws {
30-
try self.init(decodedFrom: decoder)
31-
}
32-
#endif
33-
3424
@available(*, deprecated, message: """
3525
This method is only deprecated to silence the deprecation warning of the property \
3626
segment. Our Xcode project has deprecations as warnings and warnings as errors \

Tests/SentryTests/Persistence/SentryScopePersistentStoreTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class SentryScopePersistentStoreTests: XCTestCase {
262262
XCTAssertTrue(fm.fileExists(atPath: userFileURL.path))
263263

264264
let writtenData = try Data(contentsOf: userFileURL)
265-
let decodedUser = try JSONDecoder().decode(User.self, from: writtenData)
265+
let decodedUser = try JSONDecoder().decode(UserDecodable.self, from: writtenData)
266266

267267
XCTAssertEqual(decodedUser.userId, "test-user")
268268
XCTAssertEqual(decodedUser.email, "test@example.com")

Tests/SentryTests/Protocol/SentryUserTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class SentryUserTests: XCTestCase {
8181
let data = try XCTUnwrap(SentrySerializationSwift.data(withJSONObject: actual))
8282

8383
// Act
84-
let decoded = decodeFromJSONData(jsonData: data) as User?
84+
let decoded = decodeFromJSONData(jsonData: data) as UserDecodable?
8585

8686
// Assert
8787
XCTAssertEqual(user, decoded)
@@ -94,7 +94,7 @@ class SentryUserTests: XCTestCase {
9494
let data = try XCTUnwrap(SentrySerializationSwift.data(withJSONObject: actual))
9595

9696
// Act
97-
let decoded = decodeFromJSONData(jsonData: data) as User?
97+
let decoded = decodeFromJSONData(jsonData: data) as UserDecodable?
9898

9999
// Assert
100100
XCTAssertEqual(user, decoded)

0 commit comments

Comments
 (0)