From 92e16fb7a615ed69caf1975b8a6dff47d282d1cf Mon Sep 17 00:00:00 2001 From: Garrett Moon Date: Thu, 14 Jul 2016 14:25:44 -0700 Subject: [PATCH] Share ASDK's PINRemoteImage cache with default instance of PINRemoteImage --- .../Details/ASPINRemoteImageDownloader.m | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m b/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m index 99fad4ecc4..a62424ca4d 100644 --- a/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m +++ b/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m @@ -30,6 +30,19 @@ #import #if PIN_ANIMATED_AVAILABLE +@interface ASPINRemoteImageManager : PINRemoteImageManager +@end + +@implementation ASPINRemoteImageManager + +//Share image cache with sharedImageManager image cache. +- (PINCache *)defaultImageCache +{ + return [[PINRemoteImageManager sharedImageManager] cache]; +} + +@end + @interface ASPINRemoteImageDownloader () @end @@ -82,7 +95,7 @@ - (PINRemoteImageManager *)sharedPINRemoteImageManager { - static PINRemoteImageManager *sharedPINRemoteImageManager = nil; + static ASPINRemoteImageManager *sharedPINRemoteImageManager = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @@ -102,9 +115,9 @@ userInfo:nil]; @throw e; } - sharedPINRemoteImageManager = [[PINRemoteImageManager alloc] initWithSessionConfiguration:nil alternativeRepresentationProvider:self]; + sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:nil alternativeRepresentationProvider:self]; #else - sharedPINRemoteImageManager = [[PINRemoteImageManager alloc] initWithSessionConfiguration:nil]; + sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:nil]; #endif }); return sharedPINRemoteImageManager;