From 22a8c43bca2f3c815bf6561d4742e9c2c96b1fe5 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Thu, 9 Aug 2018 17:21:24 +0800 Subject: [PATCH] Put download token init internal --- SDWebImage/SDWebImageDownloader.h | 7 ------- SDWebImage/SDWebImageDownloader.m | 8 ++++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/SDWebImage/SDWebImageDownloader.h b/SDWebImage/SDWebImageDownloader.h index b1d2d120..351d57d1 100644 --- a/SDWebImage/SDWebImageDownloader.h +++ b/SDWebImage/SDWebImageDownloader.h @@ -91,8 +91,6 @@ FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStopNotification; typedef SDImageLoaderProgressBlock SDWebImageDownloaderProgressBlock; typedef SDImageLoaderCompletedBlock SDWebImageDownloaderCompletedBlock; -@protocol SDWebImageDownloaderOperation; - /** * A token associated with each download. Can be used to cancel a download */ @@ -118,11 +116,6 @@ typedef SDImageLoaderCompletedBlock SDWebImageDownloaderCompletedBlock; */ @property (nonatomic, strong, nullable, readonly) NSURLResponse *response; -/** - Init download token with downloadOperation. - */ -- (nonnull instancetype)initWithDownloadOperation:(nullable NSOperation *)downloadOperation; - @end diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index ad4419ea..a7eef36e 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -23,6 +23,10 @@ static void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext; @property (nonatomic, weak, nullable) SDWebImageDownloader *downloader; @property (nonatomic, assign, getter=isCancelled) BOOL cancelled; +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)new NS_UNAVAILABLE; +- (nonnull instancetype)initWithDownloadOperation:(nullable NSOperation *)downloadOperation NS_DESIGNATED_INITIALIZER; + @end @interface SDWebImageDownloader () @@ -431,10 +435,6 @@ didReceiveResponse:(NSURLResponse *)response [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadReceiveResponseNotification object:nil]; } -- (instancetype)init { - return [self initWithDownloadOperation:nil]; -} - - (instancetype)initWithDownloadOperation:(NSOperation *)downloadOperation { self = [super init]; if (self) {