|
11 | 11 | #import <QuartzCore/QuartzCore.h> |
12 | 12 | #import "YLGIFImage.h" |
13 | 13 | #import "YLImageView.h" |
14 | | -#import "UIImageView+AFNetworking.h" |
15 | 14 |
|
16 | 15 | @interface MJPhotoView () |
17 | 16 | { |
@@ -95,32 +94,17 @@ - (void)photoStartLoad |
95 | 94 | ESWeak_(_photoLoadingView); |
96 | 95 | ESWeak_(_imageView); |
97 | 96 |
|
98 | | - if ([_photo.url.absoluteString rangeOfString:@"imagePreview"].location != NSNotFound) { |
99 | | - [_imageView setImageWithURLRequest:[[NSURLRequest alloc] initWithURL:_photo.url] placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) { |
100 | | - ESStrongSelf; |
101 | | - ESStrong_(_imageView); |
102 | | - __imageView.image = image; |
103 | | - [_self photoDidFinishLoadWithImage:image]; |
104 | | - |
105 | | - } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) { |
106 | | - ESStrongSelf; |
107 | | - ESStrong_(_imageView); |
108 | | - __imageView.image = nil; |
109 | | - [_self photoDidFinishLoadWithImage:nil]; |
110 | | - }]; |
111 | | - }else{ |
112 | | - [SDWebImageManager.sharedManager downloadImageWithURL:_photo.url options:SDWebImageRetryFailed|SDWebImageLowPriority| SDWebImageHandleCookies progress:^(NSInteger receivedSize, NSInteger expectedSize) { |
113 | | - ESStrong_(_photoLoadingView); |
114 | | - if (receivedSize > kMinProgress) { |
115 | | - __photoLoadingView.progress = (float)receivedSize/expectedSize; |
116 | | - } |
117 | | - } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { |
118 | | - ESStrongSelf; |
119 | | - ESStrong_(_imageView); |
120 | | - __imageView.image = image; |
121 | | - [_self photoDidFinishLoadWithImage:image]; |
122 | | - }]; |
123 | | - } |
| 97 | + [SDWebImageManager.sharedManager downloadImageWithURL:_photo.url options:SDWebImageRetryFailed| SDWebImageLowPriority| SDWebImageHandleCookies progress:^(NSInteger receivedSize, NSInteger expectedSize) { |
| 98 | + ESStrong_(_photoLoadingView); |
| 99 | + if (receivedSize > kMinProgress) { |
| 100 | + __photoLoadingView.progress = (float)receivedSize/expectedSize; |
| 101 | + } |
| 102 | + } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { |
| 103 | + ESStrongSelf; |
| 104 | + ESStrong_(_imageView); |
| 105 | + __imageView.image = image; |
| 106 | + [_self photoDidFinishLoadWithImage:image]; |
| 107 | + }]; |
124 | 108 | } |
125 | 109 | } |
126 | 110 |
|
|
0 commit comments