EMSDWebImageDownloaderOperation.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * This file is part of the SDWebImage package.
  3. * (c) Olivier Poitrey <rs@dailymotion.com>
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. #import <Foundation/Foundation.h>
  9. #import "EMSDWebImageDownloader.h"
  10. #import "EMSDWebImageOperation.h"
  11. @interface EMSDWebImageDownloaderOperation : NSOperation <EMSDWebImageOperation>
  12. /**
  13. * The request used by the operation's connection.
  14. */
  15. @property (strong, nonatomic, readonly) NSURLRequest *request;
  16. /**
  17. * Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default.
  18. *
  19. * This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`.
  20. */
  21. @property (nonatomic, assign) BOOL shouldUseCredentialStorage;
  22. /**
  23. * The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`.
  24. *
  25. * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present.
  26. */
  27. @property (nonatomic, strong) NSURLCredential *credential;
  28. /**
  29. * The EMSDWebImageDownloaderOptions for the receiver.
  30. */
  31. @property (assign, nonatomic, readonly) EMSDWebImageDownloaderOptions options;
  32. /**
  33. * Initializes a `EMSDWebImageDownloaderOperation` object
  34. *
  35. * @see EMSDWebImageDownloaderOperation
  36. *
  37. * @param request the URL request
  38. * @param options downloader options
  39. * @param progressBlock the block executed when a new chunk of data arrives.
  40. * @note the progress block is executed on a background queue
  41. * @param completedBlock the block executed when the download is done.
  42. * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue
  43. * @param cancelBlock the block executed if the download (operation) is cancelled
  44. *
  45. * @return the initialized instance
  46. */
  47. - (id)initWithRequest:(NSURLRequest *)request
  48. options:(EMSDWebImageDownloaderOptions)options
  49. progress:(EMSDWebImageDownloaderProgressBlock)progressBlock
  50. completed:(EMSDWebImageDownloaderCompletedBlock)completedBlock
  51. cancelled:(EMSDWebImageNoParamsBlock)cancelBlock;
  52. @end