Merge pull request #1923 from garrettmoon/shareMemoryCache

Share ASDK's PINRemoteImage cache with default instance of PINRemoteI…
This commit is contained in:
Michael Schneider 2016-07-14 15:00:16 -07:00 committed by GitHub
commit f95790f280

View File

@ -30,6 +30,7 @@
#import <PINCache/PINCache.h>
#if PIN_ANIMATED_AVAILABLE
@interface ASPINRemoteImageDownloader () <PINRemoteImageManagerAlternateRepresentationProvider>
@end
@ -68,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
@ -82,7 +96,7 @@
- (PINRemoteImageManager *)sharedPINRemoteImageManager
{
static PINRemoteImageManager *sharedPINRemoteImageManager = nil;
static ASPINRemoteImageManager *sharedPINRemoteImageManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
@ -102,9 +116,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;