mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-19 12:49:02 +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
|
+ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration
|
||||||
{
|
{
|
||||||
NSAssert(sharedDownloader == nil, @"Singleton has been created and session can no longer be configured.");
|
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
|
+ (PINRemoteImageManager *)sharedPINRemoteImageManagerWithConfiguration:(NSURLSessionConfiguration *)configuration
|
||||||
{
|
|
||||||
return [self sharedPINRemoteImageManagerWithConfiguration:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (PINRemoteImageManager *)sharedPINRemoteImageManagerWithConfiguration:(NSURLSessionConfiguration *)configuration
|
|
||||||
{
|
{
|
||||||
static ASPINRemoteImageManager *sharedPINRemoteImageManager;
|
static ASPINRemoteImageManager *sharedPINRemoteImageManager;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
@ -133,7 +128,8 @@ static ASPINRemoteImageDownloader *sharedDownloader = nil;
|
|||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
@throw e;
|
@throw e;
|
||||||
}
|
}
|
||||||
sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration alternativeRepresentationProvider:self];
|
sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration
|
||||||
|
alternativeRepresentationProvider:[self sharedDownloader]];
|
||||||
#else
|
#else
|
||||||
sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration];
|
sharedPINRemoteImageManager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration];
|
||||||
#endif
|
#endif
|
||||||
@ -141,6 +137,11 @@ static ASPINRemoteImageDownloader *sharedDownloader = nil;
|
|||||||
return sharedPINRemoteImageManager;
|
return sharedPINRemoteImageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (PINRemoteImageManager *)sharedPINRemoteImageManager
|
||||||
|
{
|
||||||
|
return [ASPINRemoteImageDownloader sharedPINRemoteImageManagerWithConfiguration:nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)sharedImageManagerSupportsMemoryRemoval
|
- (BOOL)sharedImageManagerSupportsMemoryRemoval
|
||||||
{
|
{
|
||||||
static BOOL sharedImageManagerSupportsMemoryRemoval = NO;
|
static BOOL sharedImageManagerSupportsMemoryRemoval = NO;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user