More perf tweaks for conversation view.

pull/1/head
Matthew Chen 6 years ago
parent 91c246cf50
commit 2bf0c55ab0

@ -31,15 +31,6 @@ NS_ASSUME_NONNULL_BEGIN
return CGSizeZero; return CGSizeZero;
} }
- (void)setIsCellVisible:(BOOL)isCellVisible
{
_isCellVisible = isCellVisible;
if (isCellVisible) {
[self layoutIfNeeded];
}
}
// For perf reasons, skip the default implementation which is only relevant for self-sizing cells. // For perf reasons, skip the default implementation which is only relevant for self-sizing cells.
- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes: - (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:
(UICollectionViewLayoutAttributes *)layoutAttributes (UICollectionViewLayoutAttributes *)layoutAttributes

@ -164,7 +164,7 @@ const CGFloat kMaxTextViewHeight = 98;
[self addSubview:self.contentRows]; [self addSubview:self.contentRows];
[self.contentRows autoPinEdgesToSuperviewEdges]; [self.contentRows autoPinEdgesToSuperviewEdges];
[self ensureShouldShowVoiceMemoButtonAnimated:NO]; [self ensureShouldShowVoiceMemoButtonAnimated:NO doLayout:NO];
} }
- (void)updateFontSizes - (void)updateFontSizes
@ -193,7 +193,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.inputTextView.text = value; self.inputTextView.text = value;
[self ensureShouldShowVoiceMemoButtonAnimated:isAnimated]; [self ensureShouldShowVoiceMemoButtonAnimated:isAnimated doLayout:YES];
[self ensureTextViewHeight]; [self ensureTextViewHeight];
} }
@ -289,7 +289,7 @@ const CGFloat kMaxTextViewHeight = 98;
return self.inputTextView.isFirstResponder; return self.inputTextView.isFirstResponder;
} }
- (void)ensureShouldShowVoiceMemoButtonAnimated:(BOOL)isAnimated - (void)ensureShouldShowVoiceMemoButtonAnimated:(BOOL)isAnimated doLayout:(BOOL)doLayout
{ {
void (^updateBlock)(void) = ^{ void (^updateBlock)(void) = ^{
if (self.inputTextView.trimmedText.length > 0) { if (self.inputTextView.trimmedText.length > 0) {
@ -309,7 +309,9 @@ const CGFloat kMaxTextViewHeight = 98;
self.sendButton.hidden = YES; self.sendButton.hidden = YES;
} }
} }
if (doLayout) {
[self layoutIfNeeded]; [self layoutIfNeeded];
}
}; };
if (isAnimated) { if (isAnimated) {
@ -598,7 +600,7 @@ const CGFloat kMaxTextViewHeight = 98;
- (void)textViewDidChange:(UITextView *)textView - (void)textViewDidChange:(UITextView *)textView
{ {
OWSAssertDebug(self.inputToolbarDelegate); OWSAssertDebug(self.inputToolbarDelegate);
[self ensureShouldShowVoiceMemoButtonAnimated:YES]; [self ensureShouldShowVoiceMemoButtonAnimated:YES doLayout:YES];
[self updateHeightWithTextView:textView]; [self updateHeightWithTextView:textView];
} }

@ -382,7 +382,9 @@ static const int kYapDatabaseRangeMinLength = 0;
{ {
BOOL hasEarlierUnseenMessages = self.dynamicInteractions.unreadIndicator.hasMoreUnseenMessages; BOOL hasEarlierUnseenMessages = self.dynamicInteractions.unreadIndicator.hasMoreUnseenMessages;
[self loadNMoreMessages:kYapDatabasePageSize]; // Now that we're using a "minimal" page size, we should
// increase the load window by 2 pages at a time.
[self loadNMoreMessages:kYapDatabasePageSize * 2];
// Dont auto-scroll afterloading more messagesunless we havemore unseen messages. // Dont auto-scroll afterloading more messagesunless we havemore unseen messages.
// //

Loading…
Cancel
Save