Skip to content

Commit

Permalink
revert rename of sentryuser (#2462)
Browse files Browse the repository at this point in the history
Reverted renaming of User to SentryUser
  • Loading branch information
brustolin authored Nov 29, 2022
1 parent 1ef804d commit 9f8d429
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ This version adds a dependency on Swift.
- Rename `SentryScope.add(_ crumb:)` to `SentryScope.addBreadcrumb(_ crumb:)` (#2416)
- Rename `SentryScope.add(_ attachment:)` to `SentryScope.addAttachment(_ attachment:)` (#2416)
- Rename `Client` to `SentryClient` (#2403)
- Rename `User` to `SentryUser` (#2403)
- Remove public APIs
- Remove `SentryScope.apply(to:)` (#2416)
- Remove `SentryScope.apply(to:maxBreadcrumb:)` (#2416)
Expand Down
4 changes: 2 additions & 2 deletions Samples/iOS-Swift/iOS-Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ViewController: UIViewController {
scope.setTag(value: "swift", key: "language")
scope.setExtra(value: String(describing: self), key: "currentViewController")

let user = SentryUser(userId: "1")
let user = User(userId: "1")
user.email = "[email protected]"
scope.setUser(user)

Expand All @@ -33,7 +33,7 @@ class ViewController: UIViewController {
}

// Also works
let user = SentryUser(userId: "1")
let user = User(userId: "1")
user.email = "[email protected]"
SentrySDK.setUser(user)

Expand Down
1 change: 1 addition & 0 deletions Sources/Sentry/Public/SentryUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(User)
@interface SentryUser : NSObject <SentrySerializable, NSCopying>

/**
Expand Down
16 changes: 8 additions & 8 deletions Tests/SentryTests/Protocol/SentryUserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import XCTest
class SentryUserTests: XCTestCase {

func testSerializationWithAllProperties() {
let user = TestData.user.copy() as! SentryUser
let user = TestData.user.copy() as! User
let actual = user.serialize()

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

func testSerializationWithOnlyId() {
let user = SentryUser(userId: "someid")
let user = User(userId: "someid")
let actual = user.serialize()

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

func testSerializationWithoutId() {
let user = SentryUser()
let user = User()
let actual = user.serialize()

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

func testIsEqualToCopy() {
XCTAssertEqual(TestData.user, TestData.user.copy() as! SentryUser)
XCTAssertEqual(TestData.user, TestData.user.copy() as! User)
}

func testNotIsEqual() {
Expand All @@ -67,15 +67,15 @@ class SentryUserTests: XCTestCase {
testIsNotEqual { user in user.data?.removeAll() }
}

func testIsNotEqual(block: (SentryUser) -> Void ) {
let user = TestData.user.copy() as! SentryUser
func testIsNotEqual(block: (User) -> Void ) {
let user = TestData.user.copy() as! User
block(user)
XCTAssertNotEqual(TestData.user, user)
}

func testCopyWithZone_CopiesDeepCopy() {
let user = TestData.user
let copiedUser = user.copy() as! SentryUser
let copiedUser = user.copy() as! User

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

let user = TestData.user.copy() as! SentryUser
let user = TestData.user.copy() as! User

for i in 0...20 {
group.enter()
Expand Down
4 changes: 2 additions & 2 deletions Tests/SentryTests/Protocol/TestData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class TestData {
return event
}

static var user: SentryUser {
let user = SentryUser(userId: "id")
static var user: User {
let user = User(userId: "id")
user.email = "[email protected]"
user.username = "user123"
user.ipAddress = "127.0.0.1"
Expand Down
4 changes: 2 additions & 2 deletions Tests/SentryTests/SentryClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SentryClientTest: XCTestCase {
let messageAsString = "message"
let message: SentryMessage

let user: SentryUser
let user: User
let fileManager: SentryFileManager
let random = TestRandom(value: 1.0)

Expand All @@ -44,7 +44,7 @@ class SentryClientTest: XCTestCase {
event = Event()
event.message = message

user = SentryUser()
user = User()
user.email = "[email protected]"
user.ipAddress = "127.0.0.1"

Expand Down
2 changes: 1 addition & 1 deletion Tests/SentryTests/SentryHubTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class SentryHubTests: XCTestCase {
let client = SentryClient(options: fixture.options)
let hub = SentryHub(client: client, andScope: Scope())

let user = SentryUser()
let user = User()
user.userId = "123"
hub.setUser(user)

Expand Down
10 changes: 5 additions & 5 deletions Tests/SentryTests/SentryScopeSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import XCTest
class SentryScopeSwiftTests: XCTestCase {

private class Fixture {
let user: SentryUser
let user: User
let breadcrumb: Breadcrumb
let scope: Scope
let date: Date
Expand All @@ -25,7 +25,7 @@ class SentryScopeSwiftTests: XCTestCase {
init() {
date = Date(timeIntervalSince1970: 10)

user = SentryUser(userId: "id")
user = User(userId: "id")
user.email = "[email protected]"
user.username = "user123"
user.ipAddress = ipAddress
Expand Down Expand Up @@ -85,7 +85,7 @@ class SentryScopeSwiftTests: XCTestCase {
scope.setTag(value: "another", key: "another")
scope.setExtra(value: "another", key: "another")
scope.setContext(value: ["": 1], key: "another")
scope.setUser(SentryUser())
scope.setUser(User())
scope.setDist("")
scope.setEnvironment("")
scope.setFingerprint([])
Expand Down Expand Up @@ -558,8 +558,8 @@ class SentryScopeSwiftTests: XCTestCase {
clearInvocations += 1
}

var user: SentryUser?
func setUser(_ user: SentryUser?) {
var user: User?
func setUser(_ user: User?) {
self.user = user
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/SentryTests/SentrySessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SentrySessionTestsSwift: XCTestCase {
}

func testCopySession() {
let user = SentryUser()
let user = User()
user.email = "[email protected]"

let session = SentrySession(releaseName: "1.0.0")
Expand Down
2 changes: 1 addition & 1 deletion Tests/SentryTests/Transaction/SentryTraceStateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SentryTraceContextTests: XCTestCase {
tracer = SentryTracer(transactionContext: TransactionContext(name: transactionName, operation: transactionOperation), hub: nil)

scope = Scope()
scope.setUser(SentryUser(userId: userId))
scope.setUser(User(userId: userId))
scope.userObject?.segment = userSegment
scope.span = tracer

Expand Down

0 comments on commit 9f8d429

Please sign in to comment.