Move attachment registration to RoomViewController

This commit is contained in:
aringenbach
2022-05-09 09:25:39 +02:00
parent 4449e06e69
commit cf448fb49e
2 changed files with 14 additions and 5 deletions
+14
View File
@@ -276,10 +276,23 @@ static CGSize kThreadListBarButtonItemImageSize;
return result;
}
/// Register provider for Pills.
+ (void)registerPillAttachmentViewProviderIfNeeded
{
if (@available(iOS 15.0, *))
{
if (![NSTextAttachment textAttachmentViewProviderClassForFileType:StringPillsUtils.pillUTType])
{
[NSTextAttachment registerTextAttachmentViewProviderClass:PillAttachmentViewProvider.class forFileType:StringPillsUtils.pillUTType];
}
}
}
#pragma mark -
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil
{
[RoomViewController registerPillAttachmentViewProviderIfNeeded];
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
@@ -295,6 +308,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
[RoomViewController registerPillAttachmentViewProviderIfNeeded];
self = [super initWithCoder:aDecoder];
if (self)
{