|
|
@ -4822,14 +4822,17 @@ typedef enum : NSUInteger {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
|
|
|
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
|
|
|
|
|
|
|
|
|
|
|
// Update and snapshot the "last known distance from bottom".
|
|
|
|
// Snapshot the "last visible row".
|
|
|
|
[self updateLastKnownDistanceFromBottom];
|
|
|
|
NSIndexPath *_Nullable lastVisibleIndexPath = self.lastVisibleIndexPath;
|
|
|
|
NSNumber *_Nullable lastKnownDistanceFromBottom = self.lastKnownDistanceFromBottom;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__weak ConversationViewController *weakSelf = self;
|
|
|
|
__weak ConversationViewController *weakSelf = self;
|
|
|
|
[coordinator
|
|
|
|
[coordinator
|
|
|
|
animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
|
|
|
animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
|
|
|
// Do nothing.
|
|
|
|
if (lastVisibleIndexPath) {
|
|
|
|
|
|
|
|
[self.collectionView scrollToItemAtIndexPath:lastVisibleIndexPath
|
|
|
|
|
|
|
|
atScrollPosition:UICollectionViewScrollPositionBottom
|
|
|
|
|
|
|
|
animated:NO];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
|
|
|
completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
|
|
|
ConversationViewController *strongSelf = weakSelf;
|
|
|
|
ConversationViewController *strongSelf = weakSelf;
|
|
|
@ -4841,13 +4844,10 @@ typedef enum : NSUInteger {
|
|
|
|
// new size.
|
|
|
|
// new size.
|
|
|
|
[strongSelf resetForSizeOrOrientationChange];
|
|
|
|
[strongSelf resetForSizeOrOrientationChange];
|
|
|
|
|
|
|
|
|
|
|
|
if (lastKnownDistanceFromBottom) {
|
|
|
|
if (lastVisibleIndexPath) {
|
|
|
|
NSValue *_Nullable contentOffsetValue =
|
|
|
|
[strongSelf.collectionView scrollToItemAtIndexPath:lastVisibleIndexPath
|
|
|
|
[strongSelf contentOffsetForLastKnownDistanceFromBottom:lastKnownDistanceFromBottom.floatValue];
|
|
|
|
atScrollPosition:UICollectionViewScrollPositionBottom
|
|
|
|
if (contentOffsetValue) {
|
|
|
|
animated:NO];
|
|
|
|
CGPoint contentOffset = contentOffsetValue.CGPointValue;
|
|
|
|
|
|
|
|
[strongSelf.collectionView setContentOffset:contentOffset animated:NO];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|