mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-16 17:00:58 +00:00
Merge pull request #2655 from rahul-malik/rmalik-nsurlsessionfix
Re-add NSURLSessionConfiguration support and fix crashes
This commit is contained in:
commit
479dd6740e
@ -103,15 +103,10 @@ static ASPINRemoteImageDownloader *sharedDownloader = nil;
|
||||
+ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration
|
||||
{
|
||||
NSAssert(sharedDownloader == nil, @"Singleton has been created and session can no longer be configured.");
|
||||
__unused PINRemoteImageManager *sharedManager = [[self class] sharedPINRemoteImageManagerWithConfiguration:configuration];
|
||||
__unused PINRemoteImageManager *sharedManager = [self sharedPINRemoteImageManagerWithConfiguration:configuration];
|
||||
}
|
||||
|
||||
- (PINRemoteImageManager *)sharedPINRemoteImageManager
|
||||
{
|
||||
return [self sharedPINRemoteImageManagerWithConfiguration:nil];
|
||||
}
|
||||
|
||||
- (PINRemoteImageManager *)sharedPINRemoteImageManagerWithConfiguration:(NSURLSessionConfiguration *)configuration
|
||||
+ (PINRemoteImageManager *)sharedPINRemoteImageManagerWithConfiguration:(NSURLSessionConfiguration *)configuration
|
||||
{
|
||||
static ASPINRemoteImageManager *sharedPINRemoteImageManager;
|
||||
static dispatch_once_t onceToken;
|
||||
@ -133,7 +128,8 @@ static ASPINRemoteImageDownloader *sharedDownloader = nil;
|
||||
userInfo:nil];
|
||||
@throw e;
|
||||
}
|
||||
sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration alternativeRepresentationProvider:self];
|
||||
sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration
|
||||
alternativeRepresentationProvider:[self sharedDownloader]];
|
||||
#else
|
||||
sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration];
|
||||
#endif
|
||||
@ -141,6 +137,11 @@ static ASPINRemoteImageDownloader *sharedDownloader = nil;
|
||||
return sharedPINRemoteImageManager;
|
||||
}
|
||||
|
||||
- (PINRemoteImageManager *)sharedPINRemoteImageManager
|
||||
{
|
||||
return [ASPINRemoteImageDownloader sharedPINRemoteImageManagerWithConfiguration:nil];
|
||||
}
|
||||
|
||||
- (BOOL)sharedImageManagerSupportsMemoryRemoval
|
||||
{
|
||||
static BOOL sharedImageManagerSupportsMemoryRemoval = NO;
|
||||
|
Loading…
x
Reference in New Issue
Block a user