mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
Move NSTextAttachment view provider registration to finalizeInit
This commit is contained in:
parent
f64369b9a7
commit
4d581447c5
1 changed files with 15 additions and 15 deletions
|
@ -276,23 +276,10 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register provider for Pills.
|
|
||||||
+ (void)registerPillAttachmentViewProviderIfNeeded
|
|
||||||
{
|
|
||||||
if (@available(iOS 15.0, *))
|
|
||||||
{
|
|
||||||
if (![NSTextAttachment textAttachmentViewProviderClassForFileType:PillsFormatter.pillUTType])
|
|
||||||
{
|
|
||||||
[NSTextAttachment registerTextAttachmentViewProviderClass:PillAttachmentViewProvider.class forFileType:PillsFormatter.pillUTType];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil
|
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil
|
||||||
{
|
{
|
||||||
[RoomViewController registerPillAttachmentViewProviderIfNeeded];
|
|
||||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
|
@ -308,7 +295,6 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||||
|
|
||||||
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
|
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
[RoomViewController registerPillAttachmentViewProviderIfNeeded];
|
|
||||||
self = [super initWithCoder:aDecoder];
|
self = [super initWithCoder:aDecoder];
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
|
@ -327,7 +313,8 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||||
- (void)finalizeInit
|
- (void)finalizeInit
|
||||||
{
|
{
|
||||||
[super finalizeInit];
|
[super finalizeInit];
|
||||||
|
|
||||||
|
[self registerPillAttachmentViewProviderIfNeeded];
|
||||||
self.resizeComposerAnimationDuration = kResizeComposerAnimationDuration;
|
self.resizeComposerAnimationDuration = kResizeComposerAnimationDuration;
|
||||||
|
|
||||||
// Setup `MXKViewControllerHandling` properties
|
// Setup `MXKViewControllerHandling` properties
|
||||||
|
@ -7569,4 +7556,17 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||||
[self stopActivityIndicator];
|
[self stopActivityIndicator];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Pills
|
||||||
|
/// Register provider for Pills.
|
||||||
|
- (void)registerPillAttachmentViewProviderIfNeeded
|
||||||
|
{
|
||||||
|
if (@available(iOS 15.0, *))
|
||||||
|
{
|
||||||
|
if (![NSTextAttachment textAttachmentViewProviderClassForFileType:PillsFormatter.pillUTType])
|
||||||
|
{
|
||||||
|
[NSTextAttachment registerTextAttachmentViewProviderClass:PillAttachmentViewProvider.class forFileType:PillsFormatter.pillUTType];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue