Skip to content

Commit

Permalink
NetworkingImageNode: update URL if we found image in assets (#1473)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwuzw authored and nguyenhuy committed Jun 7, 2019
1 parent 731db8c commit 1cb2334
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/ASNetworkImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ - (void)_locked_cancelImageDownloadWithResumePossibility:(BOOL)storeResume

if (_downloadIdentifier) {
if (storeResume && _networkImageNodeFlags.downloaderImplementsCancelWithResume) {
as_log_verbose(ASImageLoadingLog(), "Canceling image download w resume for %@ id: %@", self, _downloadIdentifier);
as_log_verbose(ASImageLoadingLog(), "Canceling image download with resume for %@ id: %@", self, _downloadIdentifier);
[_downloader cancelImageDownloadWithResumePossibilityForIdentifier:_downloadIdentifier];
} else {
as_log_verbose(ASImageLoadingLog(), "Canceling image download no resume for %@ id: %@", self, _downloadIdentifier);
Expand Down Expand Up @@ -671,7 +671,7 @@ - (void)_lazilyLoadImageIfNecessary
BOOL delegateWillLoadImageFromNetwork = _networkImageNodeFlags.delegateWillLoadImageFromNetwork;
BOOL delegateDidLoadImageFromCache = _networkImageNodeFlags.delegateDidLoadImageFromCache;
BOOL isImageLoaded = _networkImageNodeFlags.imageLoaded;
NSURL *URL = _URL;
__block NSURL *URL = _URL;
id currentDownloadIdentifier = _downloadIdentifier;
[self unlock];

Expand Down Expand Up @@ -701,6 +701,8 @@ - (void)_lazilyLoadImageIfNecessary
NSString *filename = [[NSBundle mainBundle] pathForResource:URL.path.lastPathComponent ofType:nil];
if (filename != nil) {
nonAnimatedImage = [[UIImage alloc] initWithContentsOfFile:filename];
// Update URL to point to newly-resolved file URL for animated image load.
URL = nonAnimatedImage ? [NSURL URLWithString:filename] : URL;
}
}

Expand Down

0 comments on commit 1cb2334

Please sign in to comment.