mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Merge pull request #1923 from garrettmoon/shareMemoryCache
Share ASDK's PINRemoteImage cache with default instance of PINRemoteI…
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user