From 3d9fe8c3a769f006565a38ad8fc3d91d18019fe8 Mon Sep 17 00:00:00 2001 From: Max Wang Date: Sun, 25 Mar 2018 12:32:00 -0700 Subject: [PATCH] Make cache support animated image (#850) * fix SIMULATE_WEB_RESPONSE not imported #449 * Fix to make rangeMode update in right time * support animated image for cache * Modify change log --- CHANGELOG.md | 1 + Source/Details/ASPINRemoteImageDownloader.m | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d37be067..79227ca03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## master * Add your own contributions to the next release on the line below this with your name. +- [ASPINRemoteImageDownloader] Allow cache to provide animated image. [Max Wang](https://github.com/wsdwsd0829) [#850](https://github.com/TextureGroup/Texture/pull/850) - [tvOS] Fixes errors when building against tvOS SDK [Alex Hill](https://github.com/alexhillc) [#728](https://github.com/TextureGroup/Texture/pull/728) - [ASDisplayNode] Add unit tests for layout z-order changes (with an open issue to fix). - [ASWrapperCellNode] Introduce a new class allowing more control of UIKit passthrough cells. diff --git a/Source/Details/ASPINRemoteImageDownloader.m b/Source/Details/ASPINRemoteImageDownloader.m index 9061026ec..eff1cb6fd 100644 --- a/Source/Details/ASPINRemoteImageDownloader.m +++ b/Source/Details/ASPINRemoteImageDownloader.m @@ -204,7 +204,15 @@ - (void)cachedImageWithURL:(NSURL *)URL { [[self sharedPINRemoteImageManager] imageFromCacheWithURL:URL processorKey:nil options:PINRemoteImageManagerDownloadOptionsSkipDecode completion:^(PINRemoteImageManagerResult * _Nonnull result) { [ASPINRemoteImageDownloader _performWithCallbackQueue:callbackQueue work:^{ +#if PIN_ANIMATED_AVAILABLE + if (result.alternativeRepresentation) { + completion(result.alternativeRepresentation); + } else { + completion(result.image); + } +#else completion(result.image); +#endif }]; }]; }