Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS11] Fix warnings #428

Merged
merged 5 commits into from
Nov 20, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
* Add your own contributions to the next release on the line below this with your name.
- [iOS11] Fix warnings [#428](https://github.com/pinterest/PINRemoteImage/pull/428) [Eke](https://github.com/Eke)

## 3.0.0 Beta 13
- [new] Support for webp and improved support for GIFs. [#411](https://github.com/pinterest/PINRemoteImage/pull/411) [garrettmoon](https://github.com/garrettmoon)
Expand Down
4 changes: 3 additions & 1 deletion PINRemoteImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ Pod::Spec.new do |s|
s.subspec "PINCache" do |pc|
pc.dependency 'PINRemoteImage/Core'
pc.dependency 'PINCache', '=3.0.1-beta.6'
pc.osx.deployment_target = osx_deployment
pc.ios.deployment_target = ios_deployment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor nit: mind fixing the spacing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem, will fix tomorrow morning. Thank you for review

pc.tvos.deployment_target = tvos_deployment
pc.osx.deployment_target = osx_deployment
pc.source_files = 'Source/Classes/PINCache/*.{h,m}'
end

Expand Down
15 changes: 12 additions & 3 deletions Source/Classes/PINURLSessionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,18 @@ - (BOOL)responseRecoverableFrom404:(NSHTTPURLResponse*)response
#if DEBUG
- (void)concurrentDownloads:(void (^_Nullable)(NSUInteger concurrentDownloads))concurrentDownloadsCompletion
{
[self.session getAllTasksWithCompletionHandler:^(NSArray<__kindof NSURLSessionTask *> * _Nonnull tasks) {
concurrentDownloadsCompletion(tasks.count);
}];
if (@available(macos 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@garrettmoon I remember we talked about not using @available to support Xcode < 9. Is this still the case?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maicki yeah, still shooting for that, but it'll be on top of this and will be a macro which uses @availabile on Xcode 9.

[self.session getAllTasksWithCompletionHandler:^(NSArray<__kindof NSURLSessionTask *> * _Nonnull tasks) {
concurrentDownloadsCompletion(tasks.count);
}];
} else {
[self.session getTasksWithCompletionHandler:^(NSArray<NSURLSessionDataTask *> * _Nonnull dataTasks,
NSArray<NSURLSessionUploadTask *> * _Nonnull uploadTasks,
NSArray<NSURLSessionDownloadTask *> * _Nonnull downloadTasks) {
NSUInteger total = dataTasks.count + uploadTasks.count + downloadTasks.count;
concurrentDownloadsCompletion(total);
}];
}
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/PINRemoteImageTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ - (void)testMaximumNumberOfDownloads
//I want this retain cycle
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
__block void (^checkConcurrentDownloads) ();
__block void (^checkConcurrentDownloads) (void);
checkConcurrentDownloads = ^{
usleep(10000);
[self.imageManager.sessionManager concurrentDownloads:^(NSUInteger concurrentDownloads) {
Expand Down