-
Notifications
You must be signed in to change notification settings - Fork 514
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
Add cancel method for PINRemoteImageManager #509
Add cancel method for PINRemoteImageManager #509
Conversation
🚫 CI failed with log |
Please add tests. |
Hmm, I'm not sure this will work. If the UUIDs are stored in a weak hash table, PINRemoteImageManager will 'lose' references to requests that the caller doesn't strongly retain the UUID to… |
@garrettmoon 🤔 Emm, |
@garrettmoon And I may have a thought to optimize |
You're right! Would you mind adding a comment to the code saying as much? |
Seems like a good optimization because it will also make the code clearer I think! |
👌 I'll make a PR later~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution here!
@@ -695,6 +697,8 @@ - (NSUUID *)downloadImageWithURL:(NSURL *)url | |||
} | |||
[task addCallbacksWithCompletionBlock:completion progressImageBlock:progressImage progressDownloadBlock:progressDownload withUUID:UUID]; | |||
[self.tasks setObject:task forKey:key]; | |||
// Relax :), task retain the UUID for us, it's ok to have a weak reference to UUID here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great comment :)
Add cancel all tasks for
PINRemoteImageManager
, it's the convenience method for user to call all tasks one shot, don't need to maintain uuids by themself.