Skip to content

Commit 94f3691

Browse files
ref: Remove unused session.user (#6897)
The session.user isn't really used anywhere in the code. While the scope applied the user to the session, the session doesn't do anything with the user property. Therefore, we can remove it. Also, the develop docs don't mention a user property. Only the distinctID that should be the userID.
1 parent c5d3752 commit 94f3691

File tree

7 files changed

+0
-23
lines changed

7 files changed

+0
-23
lines changed

Sources/Sentry/SentryScope.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,6 @@ - (NSArray *)serializeBreadcrumbs
526526

527527
- (void)applyToSession:(SentrySession *)session
528528
{
529-
SentryUser *userObject = self.userObject;
530-
if (userObject != nil) {
531-
session.user = userObject.copy;
532-
}
533-
534529
NSString *environment = self.environmentString;
535530
if (environment != nil) {
536531
// TODO: Make sure environment set on options is applied to the

Sources/Sentry/SentrySessionInternal.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ - (SentrySessionInternal *)safeCopyWithZone:(nullable NSZone *)zone
265265
copy->_duration = _duration;
266266
copy->_releaseName = _releaseName;
267267
copy.environment = self.environment;
268-
copy.user = self.user;
269268
copy->_abnormalMechanism = _abnormalMechanism;
270269
copy->_init = _init;
271270
}

Sources/Sentry/include/SentrySessionInternal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ SENTRY_NO_INIT
5151

5252
@property (nonatomic, readonly, copy) NSString *_Nullable releaseName;
5353
@property (nonatomic, copy) NSString *_Nullable environment;
54-
@property (nonatomic, copy) SentryUser *_Nullable user;
5554

5655
/**
5756
* The reason for session to become abnormal, for example an app hang.

Sources/Swift/SentrySession.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ import Foundation
115115
get { session.environment }
116116
set { session.environment = newValue }
117117
}
118-
@objc public var user: User? {
119-
get { session.user }
120-
set { session.user = newValue }
121-
}
122118
@objc public var abnormalMechanism: String? {
123119
get { session.abnormalMechanism }
124120
set { session.abnormalMechanism = newValue }

Tests/SentryTests/Integrations/Session/SentrySessionTrackerTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ class SentrySessionTrackerTests: XCTestCase {
812812
XCTAssertNotNil(session.sessionId)
813813
XCTAssertNotNil(session.distinctId)
814814
XCTAssertEqual(fixture.options.environment, session.environment)
815-
XCTAssertNil(session.user)
816815
}
817816

818817
private func assertNoInitSessionSent(file: StaticString = #file, line: UInt = #line) {

Tests/SentryTests/Protocol/SentrySession+Equality.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ - (BOOL)isEqualToSession:(SentrySession *)session
4242
if (self.environment != session.environment
4343
&& ![self.environment isEqualToString:session.environment])
4444
return NO;
45-
if (self.user != session.user && ![self.user isEqual:session.user])
46-
return NO;
4745
if (self.flagInit != session.flagInit && ![self.flagInit isEqualToNumber:session.flagInit])
4846
return NO;
4947
return YES;
@@ -63,7 +61,6 @@ - (NSUInteger)hash
6361
hash = hash * 23 + [self.timestamp hash];
6462
hash = hash * 23 + [self.releaseName hash];
6563
hash = hash * 23 + [self.environment hash];
66-
hash = hash * 23 + [self.user hash];
6764

6865
return hash;
6966
}

Tests/SentryTests/SentrySessionTests.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,12 @@ class SentrySessionTestsSwift: XCTestCase {
4545
}
4646

4747
func testCopySession() throws {
48-
let user = User()
49-
user.email = "someone@sentry.io"
50-
5148
let session = SentrySession(releaseName: "1.0.0", distinctId: "some-id")
52-
session.user = user
5349
session.abnormalMechanism = "app hang"
5450
let copiedSession = try XCTUnwrap(session.copy() as? SentrySession)
5551

5652
XCTAssertEqual(session, copiedSession)
5753
XCTAssertEqual(session.abnormalMechanism, copiedSession.abnormalMechanism)
58-
59-
// The user is copied as well
60-
session.user?.email = "someone_else@sentry.io"
61-
XCTAssertNotEqual(session, copiedSession)
6254
}
6355

6456
func testInitWithJson_Status_MapsToCorrectStatus() {

0 commit comments

Comments
 (0)