From fb517edf3770fd20b69db51e0b8be94b1d84e3c8 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 24 Apr 2020 18:13:26 +0800 Subject: [PATCH] Use the String instead of CFNetwork symbol, seems not visible on watchOS ;) --- SDWebImage/Core/SDWebImageDownloaderDecryptor.h | 5 +++++ SDWebImage/Core/SDWebImageDownloaderRequestModifier.h | 7 ++++++- SDWebImage/Core/SDWebImageDownloaderResponseModifier.h | 7 ++++++- SDWebImage/Core/SDWebImageDownloaderResponseModifier.m | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/SDWebImage/Core/SDWebImageDownloaderDecryptor.h b/SDWebImage/Core/SDWebImageDownloaderDecryptor.h index 184d4f85..682bc933 100644 --- a/SDWebImage/Core/SDWebImageDownloaderDecryptor.h +++ b/SDWebImage/Core/SDWebImageDownloaderDecryptor.h @@ -30,7 +30,12 @@ A downloader response modifier class with block. */ @interface SDWebImageDownloaderDecryptor : NSObject +/// Create the data decryptor with block +/// @param block A block to control decrypt logic - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; + +/// Create the data decryptor with block +/// @param block A block to control decrypt logic + (nonnull instancetype)decryptorWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; @end diff --git a/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h b/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h index 8928cf76..eff38844 100644 --- a/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h +++ b/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h @@ -29,7 +29,12 @@ typedef NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSU */ @interface SDWebImageDownloaderRequestModifier : NSObject +/// Create the request modifier with block +/// @param block A block to control modifier logic - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; + +/// Create the request modifier with block +/// @param block A block to control modifier logic + (nonnull instancetype)requestModifierWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; @end @@ -49,6 +54,6 @@ typedef NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSU /// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will overide the same fileds from original request. /// @param body HTTP Body /// @note This is for convenience, if you need code to control the logic, use `SDWebImageDownloaderRequestModifier` instead -- (nonnull instancetype)initWithMethod:(nullable NSString *)method headers:(nullable NSDictionary *)headers body:(nullable NSData *)body NS_DESIGNATED_INITIALIZER; +- (nonnull instancetype)initWithMethod:(nullable NSString *)method headers:(nullable NSDictionary *)headers body:(nullable NSData *)body; @end diff --git a/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h b/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h index 1032f464..6ddf6563 100644 --- a/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h +++ b/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h @@ -29,7 +29,12 @@ typedef NSURLResponse * _Nullable (^SDWebImageDownloaderResponseModifierBlock)(N */ @interface SDWebImageDownloaderResponseModifier : NSObject +/// Create the response modifier with block +/// @param block A block to control modifier logic - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block; + +/// Create the response modifier with block +/// @param block A block to control modifier logic + (nonnull instancetype)responseModifierWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block; @end @@ -49,6 +54,6 @@ typedef NSURLResponse * _Nullable (^SDWebImageDownloaderResponseModifierBlock)(N /// @param statusCode HTTP Status Code /// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will overide the same fileds from original response. /// @note This is for convenience, if you need code to control the logic, use `SDWebImageDownloaderResponseModifier` instead -- (nonnull instancetype)initWithVersion:(nullable NSString *)version statusCode:(NSInteger)statusCode headers:(nullable NSDictionary *)headers NS_DESIGNATED_INITIALIZER; +- (nonnull instancetype)initWithVersion:(nullable NSString *)version statusCode:(NSInteger)statusCode headers:(nullable NSDictionary *)headers; @end diff --git a/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m b/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m index e38f5d41..c072082e 100644 --- a/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m +++ b/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m @@ -72,7 +72,7 @@ NSString *value = self.headers[header]; mutableHeaders[header] = value; } - NSHTTPURLResponse *httpResponse = [[NSHTTPURLResponse alloc] initWithURL:response.URL statusCode:self.statusCode HTTPVersion:self.version ?: (__bridge NSString *)kCFHTTPVersion1_1 headerFields:[mutableHeaders copy]]; + NSHTTPURLResponse *httpResponse = [[NSHTTPURLResponse alloc] initWithURL:response.URL statusCode:self.statusCode HTTPVersion:self.version ?: @"HTTP/1.1" headerFields:[mutableHeaders copy]]; return httpResponse; }