酷店

SDWebImageDownloaderConfig.m 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 "SDWebImageDownloaderConfig.h"
  9. static SDWebImageDownloaderConfig * _defaultDownloaderConfig;
  10. @implementation SDWebImageDownloaderConfig
  11. + (SDWebImageDownloaderConfig *)defaultDownloaderConfig {
  12. static dispatch_once_t onceToken;
  13. dispatch_once(&onceToken, ^{
  14. _defaultDownloaderConfig = [SDWebImageDownloaderConfig new];
  15. });
  16. return _defaultDownloaderConfig;
  17. }
  18. - (instancetype)init {
  19. self = [super init];
  20. if (self) {
  21. _maxConcurrentDownloads = 6;
  22. _downloadTimeout = 15.0;
  23. _executionOrder = SDWebImageDownloaderFIFOExecutionOrder;
  24. }
  25. return self;
  26. }
  27. - (id)copyWithZone:(NSZone *)zone {
  28. SDWebImageDownloaderConfig *config = [[[self class] allocWithZone:zone] init];
  29. config.maxConcurrentDownloads = self.maxConcurrentDownloads;
  30. config.downloadTimeout = self.downloadTimeout;
  31. config.minimumProgressInterval = self.minimumProgressInterval;
  32. config.sessionConfiguration = [self.sessionConfiguration copyWithZone:zone];
  33. config.operationClass = self.operationClass;
  34. config.executionOrder = self.executionOrder;
  35. config.urlCredential = self.urlCredential;
  36. config.username = self.username;
  37. config.password = self.password;
  38. return config;
  39. }
  40. @end