mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
ConversationView first load avoids redundant layout
We are laying out the collection view, invalidating the layout, and then laying out the collection view again on first appearance of the conversation view. This is quite expensive - removing it shaves off about 30% of load time. // FREEBIE
This commit is contained in:
parent
82d13f5514
commit
273063e0aa
|
@ -4461,7 +4461,14 @@ typedef enum : NSUInteger {
|
|||
// Snapshot the scroll state by measuring the "distance from top of view to
|
||||
// bottom of content"; if the mapping's "window" size grows, it will grow
|
||||
// _upward_.
|
||||
CGFloat viewTopToContentBottom = self.safeContentHeight - self.collectionView.contentOffset.y;
|
||||
CGFloat viewTopToContentBottom = 0;
|
||||
if ([self.collectionView.collectionViewLayout isKindOfClass:[ConversationViewLayout class]]) {
|
||||
ConversationViewLayout *conversationViewLayout
|
||||
= (ConversationViewLayout *)self.collectionView.collectionViewLayout;
|
||||
if (conversationViewLayout.hasLayout) {
|
||||
viewTopToContentBottom = self.safeContentHeight - self.collectionView.contentOffset.y;
|
||||
}
|
||||
}
|
||||
|
||||
NSUInteger oldCellCount = [self.messageMappings numberOfItemsInGroup:self.thread.uniqueId];
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
|
|||
@interface ConversationViewLayout : UICollectionViewLayout
|
||||
|
||||
@property (nonatomic, weak) id<ConversationViewLayoutDelegate> delegate;
|
||||
|
||||
@property (nonatomic, readonly) BOOL hasLayout;
|
||||
@property (nonatomic, readonly) int contentWidth;
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue