More perf tweaks for conversation view.

This commit is contained in:
Matthew Chen 2018-12-13 12:49:59 -05:00
parent 91c246cf50
commit 2bf0c55ab0
3 changed files with 10 additions and 15 deletions

View File

@ -31,15 +31,6 @@ NS_ASSUME_NONNULL_BEGIN
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.
- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:
(UICollectionViewLayoutAttributes *)layoutAttributes

View File

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

View File

@ -382,7 +382,9 @@ static const int kYapDatabaseRangeMinLength = 0;
{
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 after loading more messages unless we have more unseen messages.
//