Merge pull request #2287 from dreampiggy/fix_default_config_readonly

Fix the default download config & cache config to readonly
This commit is contained in:
Bogdan Poplauschi 2018-04-18 10:41:43 +03:00 committed by GitHub
commit 6e5b9634a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 18 deletions

View File

@ -13,11 +13,10 @@
@interface SDImageCacheConfig : NSObject <NSCopying> @interface SDImageCacheConfig : NSObject <NSCopying>
/** /**
Gets/Sets the default cache config used for shared instance or initialization when it does not provide any cache config. Such as `SDImageCache.sharedImageCache`. Gets the default cache config used for shared instance or initialization when it does not provide any cache config. Such as `SDImageCache.sharedImageCache`.
@note You can modify the property on default cache config, which can be used for later created cache instance. The already created cache instance does not get affected. @note You can modify the property on default cache config, which can be used for later created cache instance. The already created cache instance does not get affected.
@note You should not pass nil to this value.
*/ */
@property (nonatomic, class, nonnull) SDImageCacheConfig *defaultCacheConfig; @property (nonatomic, class, readonly, nonnull) SDImageCacheConfig *defaultCacheConfig;
/** /**
* Whether or not to disable iCloud backup * Whether or not to disable iCloud backup

View File

@ -23,12 +23,6 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week
return _defaultCacheConfig; return _defaultCacheConfig;
} }
+ (void)setDefaultCacheConfig:(SDImageCacheConfig *)defaultCacheConfig {
if (defaultCacheConfig) {
_defaultCacheConfig = defaultCacheConfig;
}
}
- (instancetype)init { - (instancetype)init {
if (self = [super init]) { if (self = [super init]) {
_shouldDisableiCloud = YES; _shouldDisableiCloud = YES;

View File

@ -24,11 +24,10 @@ typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
@interface SDWebImageDownloaderConfig : NSObject <NSCopying> @interface SDWebImageDownloaderConfig : NSObject <NSCopying>
/** /**
Gets/Sets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`. Gets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`.
@note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected. @note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected.
@note You should not pass nil to this value.
*/ */
@property (nonatomic, class, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig; @property (nonatomic, class, readonly, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig;
/** /**
* The maximum number of concurrent downloads. * The maximum number of concurrent downloads.

View File

@ -20,12 +20,6 @@ static SDWebImageDownloaderConfig * _defaultDownloaderConfig;
return _defaultDownloaderConfig; return _defaultDownloaderConfig;
} }
+ (void)setDefaultDownloaderConfig:(SDWebImageDownloaderConfig *)defaultDownloaderConfig {
if (defaultDownloaderConfig) {
_defaultDownloaderConfig = defaultDownloaderConfig;
}
}
- (instancetype)init { - (instancetype)init {
self = [super init]; self = [super init];
if (self) { if (self) {