mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Avoid accessing PHImageManager in ASMultiplexImageNode init
This commit is contained in:
@@ -100,7 +100,7 @@ typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) {
|
||||
@property (nonatomic, readonly) id displayedImageIdentifier;
|
||||
|
||||
/**
|
||||
* @abstract The image manager that this image node should use when requesting images from the Photos framework. Defaults to `PHImageManager.defaultManager`.
|
||||
* @abstract The image manager that this image node should use when requesting images from the Photos framework. If this is `nil` (the default), then `PHImageManager.defaultManager` is used.
|
||||
|
||||
* @see `+[NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:]` below.
|
||||
*/
|
||||
|
||||
@@ -157,7 +157,6 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
|
||||
_cache = cache;
|
||||
_downloader = downloader;
|
||||
_imageManager = PHImageManager.defaultManager;
|
||||
self.shouldBypassEnsureDisplay = YES;
|
||||
|
||||
return self;
|
||||
@@ -543,7 +542,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
options.synchronous = YES;
|
||||
}
|
||||
|
||||
[self.imageManager requestImageForAsset:imageAsset targetSize:request.targetSize contentMode:request.contentMode options:options resultHandler:^(UIImage *image, NSDictionary *info) {
|
||||
PHImageManager *imageManager = self.imageManager ?: PHImageManager.defaultManager;
|
||||
[imageManager requestImageForAsset:imageAsset targetSize:request.targetSize contentMode:request.contentMode options:options resultHandler:^(UIImage *image, NSDictionary *info) {
|
||||
if (NSThread.isMainThread) {
|
||||
dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
|
||||
completionBlock(image, info[PHImageErrorKey]);
|
||||
|
||||
Reference in New Issue
Block a user