Skip to content

Commit 1ce879f

Browse files
authored
ref: Rename SentryClient and SentryUser (#2403)
1 parent 4dc66f6 commit 1ce879f

File tree

16 files changed

+38
-38
lines changed

16 files changed

+38
-38
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ This version adds a dependency on Swift.
1616
- Make `SpanProtocol.data` non nullable (#2409)
1717
- Mark `- [SpanProtocol setExtraValue:forKey:]` as deprecated (#2413)
1818
- Bump minimum supported OS versions to macOS 10.13, iOS 11, tvOS 11, and watchOS 4 (#2414)
19+
- Renaming Client to SentryClient for Swift (#2403)
20+
- Renaming User to SentryUser for Swift (#2403)
1921

2022
## 7.31.2
2123

Samples/iOS-Swift/iOS-Swift/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ViewController: UIViewController {
2020
scope.setTag(value: "swift", key: "language")
2121
scope.setExtra(value: String(describing: self), key: "currentViewController")
2222

23-
let user = Sentry.User(userId: "1")
23+
let user = SentryUser(userId: "1")
2424
user.email = "[email protected]"
2525
scope.setUser(user)
2626

@@ -33,7 +33,7 @@ class ViewController: UIViewController {
3333
}
3434

3535
// Also works
36-
let user = Sentry.User(userId: "1")
36+
let user = SentryUser(userId: "1")
3737
user.email = "[email protected]"
3838
SentrySDK.setUser(user)
3939

Sources/Sentry/Public/SentryClient.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
NS_ASSUME_NONNULL_BEGIN
77

8-
NS_SWIFT_NAME(Client)
98
@interface SentryClient : NSObject
109
SENTRY_NO_INIT
1110

Sources/Sentry/Public/SentryUser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
NS_ASSUME_NONNULL_BEGIN
55

6-
NS_SWIFT_NAME(User)
76
@interface SentryUser : NSObject <SentrySerializable, NSCopying>
87

98
/**

Tests/SentryTests/Integrations/Breadcrumbs/SentrySystemEventBreadcrumbsTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SentrySystemEventBreadcrumbsTest: XCTestCase {
2222
}
2323

2424
func getSut(scope: Scope, currentDevice: UIDevice? = UIDevice.current) -> SentrySystemEventBreadcrumbs {
25-
let client = Client(options: self.options)
25+
let client = SentryClient(options: self.options)
2626
let hub = SentryHub(client: client, andScope: scope)
2727
SentrySDK.setCurrentHub(hub)
2828

Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SentryCrashIntegrationTests: NotificationCenterTestCase {
2222
options.dsn = SentryCrashIntegrationTests.dsnAsString
2323
options.releaseName = TestData.appState.releaseName
2424

25-
let client = Client(options: options, permissionsObserver: TestSentryPermissionsObserver())
25+
let client = SentryClient(options: options, permissionsObserver: TestSentryPermissionsObserver())
2626
hub = TestHub(client: client, andScope: nil)
2727
}
2828

@@ -278,7 +278,7 @@ class SentryCrashIntegrationTests: NotificationCenterTestCase {
278278
api?.pointee.setEnabled(true)
279279

280280
let transport = TestTransport()
281-
let client = Client(options: fixture.options)
281+
let client = SentryClient(options: fixture.options)
282282
Dynamic(client).transportAdapter = TestTransportAdapter(transport: transport, options: fixture.options)
283283
hub.bindClient(client)
284284

Tests/SentryTests/Protocol/SentryUserTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import XCTest
33
class SentryUserTests: XCTestCase {
44

55
func testSerializationWithAllProperties() {
6-
let user = TestData.user.copy() as! User
6+
let user = TestData.user.copy() as! SentryUser
77
let actual = user.serialize()
88

99
// Changing the original doesn't modify the serialized
@@ -23,15 +23,15 @@ class SentryUserTests: XCTestCase {
2323
}
2424

2525
func testSerializationWithOnlyId() {
26-
let user = User(userId: "someid")
26+
let user = SentryUser(userId: "someid")
2727
let actual = user.serialize()
2828

2929
XCTAssertEqual(user.userId, actual["id"] as? String)
3030
XCTAssertEqual(1, actual.count)
3131
}
3232

3333
func testSerializationWithoutId() {
34-
let user = User()
34+
let user = SentryUser()
3535
let actual = user.serialize()
3636

3737
XCTAssertNil(actual["id"] as? String)
@@ -55,7 +55,7 @@ class SentryUserTests: XCTestCase {
5555
}
5656

5757
func testIsEqualToCopy() {
58-
XCTAssertEqual(TestData.user, TestData.user.copy() as! User)
58+
XCTAssertEqual(TestData.user, TestData.user.copy() as! SentryUser)
5959
}
6060

6161
func testNotIsEqual() {
@@ -67,15 +67,15 @@ class SentryUserTests: XCTestCase {
6767
testIsNotEqual { user in user.data?.removeAll() }
6868
}
6969

70-
func testIsNotEqual(block: (User) -> Void ) {
71-
let user = TestData.user.copy() as! User
70+
func testIsNotEqual(block: (SentryUser) -> Void ) {
71+
let user = TestData.user.copy() as! SentryUser
7272
block(user)
7373
XCTAssertNotEqual(TestData.user, user)
7474
}
7575

7676
func testCopyWithZone_CopiesDeepCopy() {
7777
let user = TestData.user
78-
let copiedUser = user.copy() as! User
78+
let copiedUser = user.copy() as! SentryUser
7979

8080
// Modifying the original does not change the copy
8181
user.userId = ""
@@ -95,7 +95,7 @@ class SentryUserTests: XCTestCase {
9595
let queue = DispatchQueue(label: "SentryScopeTests", qos: .userInteractive, attributes: [.concurrent, .initiallyInactive])
9696
let group = DispatchGroup()
9797

98-
let user = TestData.user.copy() as! User
98+
let user = TestData.user.copy() as! SentryUser
9999

100100
for i in 0...20 {
101101
group.enter()

Tests/SentryTests/Protocol/TestData.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class TestData {
5555
return event
5656
}
5757

58-
static var user: User {
59-
let user = User(userId: "id")
58+
static var user: SentryUser {
59+
let user = SentryUser(userId: "id")
6060
user.email = "[email protected]"
6161
user.username = "user123"
6262
user.ipAddress = "127.0.0.1"

Tests/SentryTests/SentryClientTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SentryClientTest: XCTestCase {
2121
let messageAsString = "message"
2222
let message: SentryMessage
2323

24-
let user: User
24+
let user: SentryUser
2525
let fileManager: SentryFileManager
2626
let random = TestRandom(value: 1.0)
2727

@@ -43,7 +43,7 @@ class SentryClientTest: XCTestCase {
4343
event = Event()
4444
event.message = message
4545

46-
user = User()
46+
user = SentryUser()
4747
user.email = "[email protected]"
4848
user.ipAddress = "127.0.0.1"
4949

@@ -57,13 +57,13 @@ class SentryClientTest: XCTestCase {
5757
transportAdapter = TestTransportAdapter(transport: transport, options: options)
5858
}
5959

60-
func getSut(configureOptions: (Options) -> Void = { _ in }) -> Client {
61-
var client: Client!
60+
func getSut(configureOptions: (Options) -> Void = { _ in }) -> SentryClient {
61+
var client: SentryClient!
6262
do {
6363
let options = try Options(dsn: SentryClientTest.dsn)
6464
configureOptions(options)
6565

66-
client = Client(
66+
client = SentryClient(
6767
options: options,
6868
transportAdapter: transportAdapter,
6969
fileManager: fileManager,
@@ -82,13 +82,13 @@ class SentryClientTest: XCTestCase {
8282
return client
8383
}
8484

85-
func getSutWithNoDsn() -> Client {
85+
func getSutWithNoDsn() -> SentryClient {
8686
getSut(configureOptions: { options in
8787
options.parsedDsn = nil
8888
})
8989
}
9090

91-
func getSutDisabledSdk() -> Client {
91+
func getSutDisabledSdk() -> SentryClient {
9292
getSut(configureOptions: { options in
9393
options.enabled = false
9494
})
@@ -1106,7 +1106,7 @@ class SentryClientTest: XCTestCase {
11061106

11071107
let options = Options()
11081108
options.dsn = SentryClientTest.dsn
1109-
let client = Client(options: options, permissionsObserver: TestSentryPermissionsObserver())
1109+
let client = SentryClient(options: options, permissionsObserver: TestSentryPermissionsObserver())
11101110

11111111
XCTAssertNil(client)
11121112

@@ -1342,7 +1342,7 @@ class SentryClientTest: XCTestCase {
13421342
return event
13431343
}
13441344

1345-
private func beforeSendReturnsNil(capture: (Client) -> Void) {
1345+
private func beforeSendReturnsNil(capture: (SentryClient) -> Void) {
13461346
capture(fixture.getSut(configureOptions: { options in
13471347
options.beforeSend = { _ in
13481348
nil

Tests/SentryTests/SentryHubTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ class SentryHubTests: XCTestCase {
178178
}
179179

180180
func testAddUserToTheScope() {
181-
let client = Client(options: fixture.options)
181+
let client = SentryClient(options: fixture.options)
182182
let hub = SentryHub(client: client, andScope: Scope())
183183

184-
let user = User()
184+
let user = SentryUser()
185185
user.userId = "123"
186186
hub.setUser(user)
187187

0 commit comments

Comments
 (0)