From 92e16fb7a615ed69caf1975b8a6dff47d282d1cf Mon Sep 17 00:00:00 2001 From: Garrett Moon Date: Thu, 14 Jul 2016 14:25:44 -0700 Subject: [PATCH 1/2] 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; From aaea4a4d85c9fa1577e176c321abf1a008aecb62 Mon Sep 17 00:00:00 2001 From: Garrett Moon Date: Thu, 14 Jul 2016 14:35:22 -0700 Subject: [PATCH 2/2] Class was in wrong #ifdef, thank you @schneider! --- .../Details/ASPINRemoteImageDownloader.m | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m b/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m index a62424ca4d..0fdfb22655 100644 --- a/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m +++ b/AsyncDisplayKit/Details/ASPINRemoteImageDownloader.m @@ -30,18 +30,6 @@ #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 () @@ -81,6 +69,19 @@ @end #endif +@interface ASPINRemoteImageManager : PINRemoteImageManager +@end + +@implementation ASPINRemoteImageManager + +//Share image cache with sharedImageManager image cache. +- (PINCache *)defaultImageCache +{ + return [[PINRemoteImageManager sharedImageManager] cache]; +} + +@end + @implementation ASPINRemoteImageDownloader + (instancetype)sharedDownloader