Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkingImageNode: update URL if we found image in assets #1473

Merged
merged 2 commits into from
Jun 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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