diff --git a/Signal/src/Models/OWSMessagesBubblesSizeCalculator.m b/Signal/src/Models/OWSMessagesBubblesSizeCalculator.m index b003c5c6c..3e48bb822 100644 --- a/Signal/src/Models/OWSMessagesBubblesSizeCalculator.m +++ b/Signal/src/Models/OWSMessagesBubblesSizeCalculator.m @@ -47,6 +47,15 @@ NS_ASSUME_NONNULL_BEGIN @implementation OWSMessagesBubblesSizeCalculator +- (instancetype)init +{ + if (self = [super init]) { + _referenceSystemMessageCell = [OWSSystemMessageCell new]; + _referenceUnreadIndicatorCell = [OWSUnreadIndicatorCell new]; + } + return self; +} + /** * Computes and returns the size of the `messageBubbleImageView` property * of a `JSQMessagesCollectionViewCell` for the specified messageData at indexPath. @@ -119,10 +128,6 @@ NS_ASSUME_NONNULL_BEGIN return [cachedSize CGSizeValue]; } - if (!self.referenceSystemMessageCell) { - _referenceSystemMessageCell = [OWSSystemMessageCell new]; - } - CGSize result = [self.referenceSystemMessageCell cellSizeForInteraction:interaction collectionViewWidth:layout.collectionView.width]; @@ -143,10 +148,6 @@ NS_ASSUME_NONNULL_BEGIN return [cachedSize CGSizeValue]; } - if (!self.referenceUnreadIndicatorCell) { - _referenceUnreadIndicatorCell = [OWSUnreadIndicatorCell new]; - } - CGSize result = [self.referenceUnreadIndicatorCell cellSizeForInteraction:interaction collectionViewWidth:layout.collectionView.width]; diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index 0b3af7343..ea8e7fe3e 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -1308,7 +1308,7 @@ typedef enum : NSUInteger { } // Bubbles - self.collectionView.collectionViewLayout.bubbleSizeCalculator = [[OWSMessagesBubblesSizeCalculator alloc] init]; + self.collectionView.collectionViewLayout.bubbleSizeCalculator = [OWSMessagesBubblesSizeCalculator new]; JSQMessagesBubbleImageFactory *bubbleFactory = [[JSQMessagesBubbleImageFactory alloc] init]; self.incomingBubbleImageData = [bubbleFactory incomingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleLightGrayColor]]; diff --git a/Signal/src/views/OWSSystemMessageCell.m b/Signal/src/views/OWSSystemMessageCell.m index 2ade8c5eb..0e72a5a88 100644 --- a/Signal/src/views/OWSSystemMessageCell.m +++ b/Signal/src/views/OWSSystemMessageCell.m @@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation OWSSystemMessageCell +// `[UIView init]` invokes `[self initWithFrame:...]`. - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { diff --git a/Signal/src/views/OWSUnreadIndicatorCell.m b/Signal/src/views/OWSUnreadIndicatorCell.m index 2af3c7610..3abaa0e8c 100644 --- a/Signal/src/views/OWSUnreadIndicatorCell.m +++ b/Signal/src/views/OWSUnreadIndicatorCell.m @@ -29,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation OWSUnreadIndicatorCell +// `[UIView init]` invokes `[self initWithFrame:...]`. - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) {