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

Allow creating a ASPINRemoteImageDownloader that ignores caches #12

Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Allow creating a ASPINRemoteImageDownloader that ignores caches
  • Loading branch information
Phil Larson committed Apr 14, 2017
commit 57339ab1662eaf913f0258d6debe30bf02aac4da
5 changes: 5 additions & 0 deletions Source/Details/ASPINRemoteImageDownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (PINRemoteImageManager *)sharedPINRemoteImageManager;

/**
* When downloading images ignore all caches. Defaults to NO.
*/
@property (nonatomic, assign) BOOL shouldIgnoreCache;

@end

NS_ASSUME_NONNULL_END
Expand Down
8 changes: 7 additions & 1 deletion Source/Details/ASPINRemoteImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ - (nullable id)downloadImageWithURL:(NSURL *)URL
downloadProgress:(ASImageDownloaderProgress)downloadProgress
completion:(ASImageDownloaderCompletion)completion;
{
return [[self sharedPINRemoteImageManager] downloadImageWithURL:URL options:PINRemoteImageManagerDownloadOptionsSkipDecode progressDownload:^(int64_t completedBytes, int64_t totalBytes) {
PINRemoteImageManagerDownloadOptions options = PINRemoteImageManagerDownloadOptionsSkipDecode;

if (_shouldIgnoreCache) {
options |= PINRemoteImageManagerDownloadOptionsIgnoreCache;
}

return [[self sharedPINRemoteImageManager] downloadImageWithURL:URL options:options progressDownload:^(int64_t completedBytes, int64_t totalBytes) {
if (downloadProgress == nil) { return; }

/// If we're targeting the main queue and we're on the main thread, call immediately.
Expand Down