mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix iOS 15.2 hanging on attachment menu opening
This commit is contained in:
parent
37cbe0a875
commit
e674cfbfa6
@ -9,6 +9,8 @@
|
||||
@interface TGMediaAssetsModernLibrary () <PHPhotoLibraryChangeObserver>
|
||||
{
|
||||
SPipe *_libraryChangePipe;
|
||||
|
||||
bool _registeredChangeObserver;
|
||||
}
|
||||
@end
|
||||
|
||||
@ -20,14 +22,21 @@
|
||||
if (self != nil)
|
||||
{
|
||||
_libraryChangePipe = [[SPipe alloc] init];
|
||||
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];
|
||||
|
||||
PHAuthorizationStatus authorizationStatus = [PHPhotoLibrary authorizationStatus];
|
||||
if (authorizationStatus == PHAuthorizationStatusAuthorized) {
|
||||
_registeredChangeObserver = true;
|
||||
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];
|
||||
if (_registeredChangeObserver) {
|
||||
[[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (SSignal *)assetGroups
|
||||
|
Loading…
x
Reference in New Issue
Block a user