Skip to content

Commit

Permalink
Requested PR updates
Browse files Browse the repository at this point in the history
  • Loading branch information
birdofpreyru committed Feb 19, 2024
1 parent 5e44e57 commit a340071
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Cache installationID async to avoid file IO on the main thread when starting the SDK (#3601)
- Add reason for NSPrivacyAccessedAPICategoryFileTimestamp (#3626)
- Exposes `tags` property of `SentryScope` (#3650)

### Fixes

Expand Down
10 changes: 5 additions & 5 deletions Sources/Sentry/Public/SentryScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ NS_SWIFT_NAME(Scope)
*/
@property (nullable, nonatomic, strong) id<SentrySpan> span;

/**
* Gets the dictionary of currently set tags.
*/
@property (nonatomic, readonly, copy) NSDictionary<NSString *, NSString *> *tags;

- (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs NS_DESIGNATED_INITIALIZER;
- (instancetype)init;
- (instancetype)initWithScope:(SentryScope *)scope;
Expand All @@ -47,11 +52,6 @@ NS_SWIFT_NAME(Scope)
*/
- (void)setTags:(NSDictionary<NSString *, NSString *> *_Nullable)tags;

/**
* Gets the dictionary of currently set tags.
*/
- (NSDictionary<NSString *, NSString *> *)tags;

/**
* Set global extra -> these will be sent with every event
*/
Expand Down
12 changes: 3 additions & 9 deletions Tests/SentryTests/SentryScopeSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -457,33 +457,27 @@ class SentryScopeSwiftTests: XCTestCase {

func testScopeObserver_setTags() {
let sut = Scope()
let observer = fixture.observer
sut.add(observer)

sut.setTags(fixture.tags)

XCTAssertEqual(fixture.tags, observer.tags)
XCTAssertEqual(fixture.tags, sut.tags)
}

func testScopeObserver_setTagValue() {
let sut = Scope()
let observer = fixture.observer
sut.add(observer)

sut.setTag(value: "tag", key: "tag")

XCTAssertEqual( ["tag": "tag"], observer.tags)
XCTAssertEqual( ["tag": "tag"], sut.tags)
}

func testScopeObserver_removeTag() {
let sut = Scope()
let observer = fixture.observer
sut.add(observer)

sut.setTag(value: "tag", key: "tag")
sut.removeTag(key: "tag")

XCTAssertEqual(0, observer.tags?.count)
XCTAssertEqual(0, sut.tags.count)
}

func testScopeObserver_setExtras() {
Expand Down

0 comments on commit a340071

Please sign in to comment.