Skip to content

Commit

Permalink
Remove stale availability checks/annotations.
Browse files Browse the repository at this point in the history
The current min version are above this (see GTMSessionFetcher.podspec or
Package.swift), so none of these checks/annotations are needed.
  • Loading branch information
thomasvl committed Nov 13, 2024
1 parent 9972f88 commit 3867c8a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 37 deletions.
7 changes: 2 additions & 5 deletions Sources/Core/GTMSessionFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -1993,9 +1993,7 @@ - (void)releaseCallbacks {
self.retryBlock = nil;
self.testBlock = nil;
self.resumeDataBlock = nil;
if (@available(iOS 10.0, *)) {
self.metricsCollectionBlock = nil;
}
self.metricsCollectionBlock = nil;
}

- (void)forgetSessionIdentifierForFetcher {
Expand Down Expand Up @@ -3114,8 +3112,7 @@ - (void)URLSession:(NSURLSession *)session

- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics
API_AVAILABLE(ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0)) {
didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics {
@synchronized(self) {
GTMSessionMonitorSynchronized(self);
GTMSessionFetcherMetricsCollectionBlock metricsCollectionBlock = _metricsCollectionBlock;
Expand Down
7 changes: 2 additions & 5 deletions Sources/Core/GTMSessionFetcherService.m
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ - (id)fetcherWithRequest:(NSURLRequest *)request fetcherClass:(Class)fetcherClas
fetcher.retryBlock = self.retryBlock;
fetcher.maxRetryInterval = self.maxRetryInterval;
fetcher.minRetryInterval = self.minRetryInterval;
if (@available(iOS 10.0, *)) {
fetcher.metricsCollectionBlock = self.metricsCollectionBlock;
}
fetcher.metricsCollectionBlock = self.metricsCollectionBlock;
fetcher.stopFetchingTriggersCompletionHandler = self.stopFetchingTriggersCompletionHandler;
fetcher.properties = self.properties;
fetcher.service = self;
Expand Down Expand Up @@ -1333,8 +1331,7 @@ - (void)URLSession:(NSURLSession *)session

- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics
API_AVAILABLE(ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0)) {
didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics {
id<NSURLSessionTaskDelegate> fetcher = [self fetcherForTask:task];
[fetcher URLSession:session task:task didFinishCollectingMetrics:metrics];
}
Expand Down
5 changes: 1 addition & 4 deletions Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ typedef void (^GTMSessionFetcherRetryResponse)(BOOL shouldRetry);
typedef void (^GTMSessionFetcherRetryBlock)(BOOL suggestedWillRetry, NSError *_Nullable error,
GTMSessionFetcherRetryResponse response);

API_AVAILABLE(ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0))
typedef void (^GTMSessionFetcherMetricsCollectionBlock)(NSURLSessionTaskMetrics *metrics);

typedef void (^GTMSessionFetcherTestResponse)(NSHTTPURLResponse *_Nullable response,
Expand Down Expand Up @@ -1077,9 +1076,7 @@ __deprecated_msg("implement GTMSessionFetcherAuthorizer instead")
// The optional block for collecting the metrics of the present session.
//
// This is called on the callback queue.
@property(atomic, copy, nullable)
GTMSessionFetcherMetricsCollectionBlock metricsCollectionBlock API_AVAILABLE(
ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0));
@property(atomic, copy, nullable) GTMSessionFetcherMetricsCollectionBlock metricsCollectionBlock;

// Retry intervals must be strictly less than maxRetryInterval, else
// they will be limited to maxRetryInterval and no further retries will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ extern NSString *const kGTMSessionFetcherServiceSessionKey;
@property(atomic, assign) NSTimeInterval maxRetryInterval;
@property(atomic, assign) NSTimeInterval minRetryInterval;
@property(atomic, copy, nullable) NSDictionary<NSString *, id> *properties;
@property(atomic, copy, nullable)
GTMSessionFetcherMetricsCollectionBlock metricsCollectionBlock API_AVAILABLE(
ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0));
@property(atomic, copy, nullable) GTMSessionFetcherMetricsCollectionBlock metricsCollectionBlock;
@property(atomic, assign) BOOL stopFetchingTriggersCompletionHandler;

#if GTM_BACKGROUND_TASK_FETCHING
Expand Down
23 changes: 7 additions & 16 deletions UnitTests/GTMSessionFetcherFetchingTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ - (void)assertCallbacksReleasedForFetcher:(GTMSessionFetcher *)fetcher {
XCTAssertNil(fetcher.downloadProgressBlock);
XCTAssertNil(fetcher.willCacheURLResponseBlock);
XCTAssertNil(fetcher.retryBlock);
if (@available(iOS 10.0, *)) {
XCTAssertNil(fetcher.metricsCollectionBlock);
}
XCTAssertNil(fetcher.metricsCollectionBlock);
XCTAssertNil(fetcher.testBlock);

if ([fetcher isKindOfClass:[GTMSessionUploadFetcher class]]) {
Expand Down Expand Up @@ -2162,8 +2160,7 @@ - (void)testInsecureRequests_WithoutFetcherService {
[self testInsecureRequests];
}

- (void)testCollectingMetrics_WithSuccessfulFetch API_AVAILABLE(ios(10.0), macosx(10.12),
tvos(10.0), watchos(6.0)) {
- (void)testCollectingMetrics_WithSuccessfulFetch {
if (!_isServerRunning) return;

CREATE_START_STOP_NOTIFICATION_EXPECTATIONS(1, 1);
Expand Down Expand Up @@ -2197,15 +2194,12 @@ - (void)testCollectingMetrics_WithSuccessfulFetch API_AVAILABLE(ios(10.0), macos
XCTAssertNotNil(collectedMetrics.transactionMetrics[0].responseEndDate);
}

- (void)testCollectingMetrics_WithSuccessfulFetch_WithoutFetcherService API_AVAILABLE(
ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0)) {
- (void)testCollectingMetrics_WithSuccessfulFetch_WithoutFetcherService {
_fetcherService = nil;
[self testCollectingMetrics_WithSuccessfulFetch];
}

- (void)testCollectingMetrics_WithWrongFetch_FaildToConnect API_AVAILABLE(ios(10.0), macosx(10.12),
tvos(10.0),
watchos(6.0)) {
- (void)testCollectingMetrics_WithWrongFetch_FaildToConnect {
if (!_isServerRunning) return;

CREATE_START_STOP_NOTIFICATION_EXPECTATIONS(1, 1);
Expand Down Expand Up @@ -2243,14 +2237,12 @@ - (void)testCollectingMetrics_WithWrongFetch_FaildToConnect API_AVAILABLE(ios(10
XCTAssertNil(collectedMetrics.transactionMetrics[0].responseEndDate);
}

- (void)testCollectingMetrics_WithWrongFetch_FaildToConnect_WithoutFetcherService API_AVAILABLE(
ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0)) {
- (void)testCollectingMetrics_WithWrongFetch_FaildToConnect_WithoutFetcherService {
_fetcherService = nil;
[self testCollectingMetrics_WithWrongFetch_FaildToConnect];
}

- (void)testCollectingMetrics_WithWrongFetch_BadStatusCode API_AVAILABLE(ios(10.0), macosx(10.12),
tvos(10.0), watchos(6.0)) {
- (void)testCollectingMetrics_WithWrongFetch_BadStatusCode {
if (!_isServerRunning) return;

CREATE_START_STOP_NOTIFICATION_EXPECTATIONS(1, 1);
Expand Down Expand Up @@ -2290,8 +2282,7 @@ - (void)testCollectingMetrics_WithWrongFetch_BadStatusCode API_AVAILABLE(ios(10.
XCTAssertNotNil(collectedMetrics.transactionMetrics[0].responseEndDate);
}

- (void)testCollectingMetrics_WithWrongFetch_BadStatusCode_WithoutFetcherService API_AVAILABLE(
ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0)) {
- (void)testCollectingMetrics_WithWrongFetch_BadStatusCode_WithoutFetcherService {
_fetcherService = nil;
[self testCollectingMetrics_WithWrongFetch_BadStatusCode];
}
Expand Down
5 changes: 1 addition & 4 deletions UnitTests/GTMSessionFetcherServiceTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -1751,10 +1751,7 @@ - (void)testDelegateDispatcherForFetcher {
[session invalidateAndCancel];
}

- (void)testFetcherUsingMetricsCollectionBlockFromFetcherService API_AVAILABLE(ios(10.0),
macosx(10.12),
tvos(10.0),
watchos(6.0)) {
- (void)testFetcherUsingMetricsCollectionBlockFromFetcherService {
if (!_isServerRunning) return;

CREATE_START_STOP_NOTIFICATION_EXPECTATIONS(1, 1);
Expand Down

0 comments on commit 3867c8a

Please sign in to comment.