Skip to content

Commit 8fa16b5

Browse files
authored
chore: Remove more deprecated APIs in V9 (#6346)
1 parent b6f8eb3 commit 8fa16b5

File tree

9 files changed

+3
-164
lines changed

9 files changed

+3
-164
lines changed

CHANGELOG-v9.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
### Breaking Changes
44

5-
Removes unused SentryLogLevel (#5591)
6-
Removes deprecated getStoreEndpoint (#5591)
7-
Removes deprecated useSpan function (#5591)
85
Removes deprecated SentryDebugImageProvider class (#5598)
96
Makes app hang tracking V2 the default and removes the option to enable/disable it (#5615)
107
Removes segment property on SentryUser, SentryBaggage, and SentryTraceContext (#5638)

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
- Moves `SentryEventDecoder` to SPI (#6365)
88
- Makes `PreviewRedactOptions`, `SentryProfileOptions`, `SentryRedactViewHelper`, `SentryViewScreenshotOptions`, `SentryReplayOptions`, `SentryUserFeedbackConfiguration`, `SentryUserFeedbackFormConfiguration`, `SentryUserFeedbackThemeConfiguration`, `SentryUserFeedbackWidgetConfiguration`, `SentryFeedback`, and `SentryExperimentalOptions` `final` (#6365)
99
- Removes Decodable conformances from the public API of model classes (#5691)
10+
- Removes unused SentryLogLevel (#5591)
11+
- Removes deprecated getStoreEndpoint (#5591)
12+
- Removes deprecated useSpan function (#5591)
1013
- Removes deprecated user feedback API, this is replaced with the new feedback API (#5591)
1114
- 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)
1215

Sources/Sentry/Public/SentryDefines.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,6 @@ typedef BOOL (^SentryShouldQueueEvent)(
146146
typedef NSNumber *_Nullable (^SentryTracesSamplerCallback)(
147147
SentrySamplingContext *_Nonnull samplingContext);
148148

149-
#if !SDK_V9
150-
/**
151-
* Function pointer for span manipulation.
152-
* @param span The span to be used.
153-
*/
154-
typedef void (^SentrySpanCallback)(id<SentrySpan> _Nullable span DEPRECATED_MSG_ATTRIBUTE(
155-
"See `SentryScope.useSpan` for reasoning of deprecation."));
156-
157-
/**
158-
* Log level.
159-
*/
160-
typedef NS_ENUM(NSInteger, SentryLogLevel) {
161-
kSentryLogLevelNone = 1,
162-
kSentryLogLevelError,
163-
kSentryLogLevelDebug,
164-
kSentryLogLevelVerbose
165-
};
166-
#endif // !SDK_V9
167-
168149
/**
169150
* Sentry level.
170151
*/

Sources/Sentry/Public/SentryDsn.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ NS_ASSUME_NONNULL_BEGIN
1111

1212
- (NSString *)getHash;
1313

14-
#if !SDK_V9
15-
- (NSURL *)getStoreEndpoint DEPRECATED_MSG_ATTRIBUTE("This endpoint is no longer used");
16-
#endif // !SDK_V9
1714
- (NSURL *)getEnvelopeEndpoint;
1815

1916
@end

Sources/Sentry/Public/SentryScope.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,6 @@ NS_SWIFT_NAME(Scope)
165165
*/
166166
- (void)clear;
167167

168-
#if !SDK_V9
169-
/**
170-
* Mutates the current transaction atomically.
171-
* @param callback the SentrySpanCallback.
172-
*/
173-
- (void)useSpan:(SentrySpanCallback)callback
174-
DEPRECATED_MSG_ATTRIBUTE(
175-
"This method was used to create an atomic block that could be used to mutate the current "
176-
"span. It is not atomic anymore and due to issues with memory safety in `NSBlock` it is "
177-
"now considered unsafe and deprecated. Use `span` instead.");
178-
#endif // !SDK_V9
179-
180168
@end
181169

182170
NS_ASSUME_NONNULL_END

Sources/Sentry/SentryDsn.m

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ @interface SentryDsn ()
1111
@end
1212

1313
@implementation SentryDsn {
14-
NSURL *_storeEndpoint;
1514
NSURL *_envelopeEndpoint;
1615
}
1716

@@ -41,20 +40,6 @@ - (NSString *)getHash
4140
return output;
4241
}
4342

44-
#if !SDK_V9
45-
- (NSURL *)getStoreEndpoint
46-
{
47-
if (nil == _storeEndpoint) {
48-
@synchronized(self) {
49-
if (nil == _storeEndpoint) {
50-
_storeEndpoint = [[self getBaseEndpoint] URLByAppendingPathComponent:@"store/"];
51-
}
52-
}
53-
}
54-
return _storeEndpoint;
55-
}
56-
#endif // !SDK_V9
57-
5843
- (NSURL *)getEnvelopeEndpoint
5944
{
6045
if (nil == _envelopeEndpoint) {

Sources/Sentry/SentryScope.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,6 @@ - (void)setPropagationContext:(SentryPropagationContext *)propagationContext
153153
}
154154
}
155155

156-
#if !SDK_V9
157-
- (void)useSpan:(SentrySpanCallback)callback
158-
{
159-
id<SentrySpan> localSpan = [self span];
160-
callback(localSpan);
161-
}
162-
#endif // !SDK_V9
163-
164156
- (void)clear
165157
{
166158
// As we need to synchronize the accesses of the arrays and dictionaries and we use the

Tests/SentryTests/Networking/SentryDsnTests.m

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,6 @@ - (void)testUnsupportedProtocol
4747
XCTAssertNil(options);
4848
}
4949

50-
#pragma clang diagnostic push
51-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
52-
- (void)testDsnUrl
53-
{
54-
NSError *error = nil;
55-
SentryDsn *dsn = [[SentryDsn alloc] initWithString:@"https://username:password@getsentry.net/1"
56-
didFailWithError:&error];
57-
58-
XCTAssertEqualObjects(
59-
[[dsn getStoreEndpoint] absoluteString], @"https://getsentry.net/api/1/store/");
60-
XCTAssertNil(error);
61-
62-
SentryDsn *dsn2 =
63-
[[SentryDsn alloc] initWithString:@"https://username:password@sentry.io/foo/bar/baz/1"
64-
didFailWithError:&error];
65-
66-
XCTAssertEqualObjects(
67-
[[dsn2 getStoreEndpoint] absoluteString], @"https://sentry.io/foo/bar/baz/api/1/store/");
68-
XCTAssertNil(error);
69-
}
70-
#pragma clang diagnostic pop
71-
7250
- (void)testGetEnvelopeUrl
7351
{
7452
NSError *error = nil;
@@ -88,19 +66,6 @@ - (void)testGetEnvelopeUrl
8866
XCTAssertNil(error);
8967
}
9068

91-
#pragma clang diagnostic push
92-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
93-
- (void)testGetStoreDsnCachesResult
94-
{
95-
SentryDsn *dsn = [[SentryDsn alloc] initWithString:@"https://username:password@getsentry.net/1"
96-
didFailWithError:nil];
97-
98-
XCTAssertNotNil([dsn getStoreEndpoint]);
99-
// Assert same reference
100-
XCTAssertTrue([dsn getStoreEndpoint] == [dsn getStoreEndpoint]);
101-
}
102-
#pragma clang diagnostic pop
103-
10469
- (void)testInitWithInvalidString
10570
{
10671
SentryDsn *dsn = [[SentryDsn alloc] initWithString:@"This is invalid DSN" didFailWithError:nil];

Tests/SentryTests/SentryScopeSwiftTests.swift

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -271,74 +271,14 @@ class SentryScopeSwiftTests: XCTestCase {
271271
XCTAssertNil(actual?.tags)
272272
XCTAssertNil(actual?.extra)
273273
}
274-
275-
@available(*, deprecated, message: "The test is marked as deprecated to silence the deprecation warning of useSpan")
276-
func testUseSpan() {
277-
fixture.scope.span = fixture.transaction
278-
fixture.scope.useSpan { (span) in
279-
XCTAssert(span === self.fixture.transaction)
280-
}
281-
}
282-
283-
@available(*, deprecated, message: "The test is marked as deprecated to silence the deprecation warning of useSpan")
284-
func testUseSpanLock_DoesNotBlock_WithBlockingCallback() {
285-
let scope = fixture.scope
286-
scope.span = fixture.transaction
287-
let queue = DispatchQueue(label: "test-queue", attributes: [.initiallyInactive, .concurrent])
288-
let expect = expectation(description: "useSpan callback is non-blocking")
289-
290-
let condition = NSCondition()
291-
var useSpanCalled = false
292-
293-
queue.async {
294-
scope.useSpan { _ in
295-
condition.lock()
296-
while !useSpanCalled {
297-
condition.wait()
298-
}
299-
condition.unlock()
300-
}
301-
}
302-
303-
queue.async {
304-
scope.useSpan { _ in
305-
useSpanCalled = true
306-
condition.broadcast()
307-
expect.fulfill()
308-
}
309-
}
310-
311-
queue.activate()
312-
313-
wait(for: [expect], timeout: 0.1)
314-
}
315274

316-
@available(*, deprecated, message: "The test is marked as deprecated to silence the deprecation warning of useSpan")
317-
func testUseSpanLock_IsReentrant() {
318-
let expect = expectation(description: "finish on time")
319-
let scope = fixture.scope
320-
scope.span = fixture.transaction
321-
scope.useSpan { _ in
322-
scope.useSpan { _ in
323-
expect.fulfill()
324-
}
325-
326-
}
327-
wait(for: [expect], timeout: 0.1)
328-
}
329-
330-
@available(*, deprecated, message: "The test is marked as deprecated to silence the deprecation warning of useSpan")
331275
func testSpan_FromMultipleThreads() {
332276
let scope = fixture.scope
333277

334278
testConcurrentModifications(asyncWorkItems: 20, writeLoopCount: 10, writeWork: { _ in
335279

336280
scope.span = SentryTracer(transactionContext: TransactionContext(name: self.fixture.transactionName, operation: self.fixture.transactionOperation), hub: nil)
337281

338-
scope.useSpan { span in
339-
XCTAssertNotNil(span)
340-
}
341-
342282
}, readWork: {
343283
XCTAssertNotNil(scope.span)
344284
})
@@ -362,15 +302,6 @@ class SentryScopeSwiftTests: XCTestCase {
362302
XCTAssertNil(serialized["breadcrumbs"])
363303
}
364304

365-
@available(*, deprecated, message: "The test is marked as deprecated to silence the deprecation warning of useSpan")
366-
func testUseSpanForClear() {
367-
fixture.scope.span = fixture.transaction
368-
fixture.scope.useSpan { (_) in
369-
self.fixture.scope.span = nil
370-
}
371-
XCTAssertNil(fixture.scope.span)
372-
}
373-
374305
func testApplyToEvent_EventWithContext() {
375306
let context = NSMutableDictionary(dictionary: ["my": ["extra": "context"],
376307
"trace": fixture.scope.propagationContext.traceForEvent() ])

0 commit comments

Comments
 (0)