|
|
@ -2793,6 +2793,7 @@ typedef enum : NSUInteger {
|
|
|
|
[super viewDidLayoutSubviews];
|
|
|
|
[super viewDidLayoutSubviews];
|
|
|
|
|
|
|
|
|
|
|
|
[self updateLastVisibleTimestamp];
|
|
|
|
[self updateLastVisibleTimestamp];
|
|
|
|
|
|
|
|
[self ensureScrollDownButton];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)createScrollDownButton
|
|
|
|
- (void)createScrollDownButton
|
|
|
@ -2838,6 +2839,14 @@ typedef enum : NSUInteger {
|
|
|
|
|
|
|
|
|
|
|
|
BOOL shouldShowScrollDownButton = NO;
|
|
|
|
BOOL shouldShowScrollDownButton = NO;
|
|
|
|
NSUInteger numberOfMessages = [self.messageMappings numberOfItemsInSection:0];
|
|
|
|
NSUInteger numberOfMessages = [self.messageMappings numberOfItemsInSection:0];
|
|
|
|
|
|
|
|
CGFloat scrollSpaceToBottom = (self.collectionView.contentSize.height + self.collectionView.contentInset.bottom
|
|
|
|
|
|
|
|
- (self.collectionView.contentOffset.y + self.collectionView.frame.size.height));
|
|
|
|
|
|
|
|
CGFloat pageHeight = (self.collectionView.frame.size.height
|
|
|
|
|
|
|
|
- (self.collectionView.contentInset.top + self.collectionView.contentInset.bottom));
|
|
|
|
|
|
|
|
// Show "scroll down" button if user is scrolled up at least
|
|
|
|
|
|
|
|
// one page.
|
|
|
|
|
|
|
|
BOOL isScrolledUp = scrollSpaceToBottom > pageHeight * 1.f;
|
|
|
|
|
|
|
|
|
|
|
|
if (numberOfMessages > 0) {
|
|
|
|
if (numberOfMessages > 0) {
|
|
|
|
TSInteraction *lastInteraction =
|
|
|
|
TSInteraction *lastInteraction =
|
|
|
|
[self interactionAtIndexPath:[NSIndexPath indexPathForRow:(NSInteger)numberOfMessages - 1 inSection:0]];
|
|
|
|
[self interactionAtIndexPath:[NSIndexPath indexPathForRow:(NSInteger)numberOfMessages - 1 inSection:0]];
|
|
|
@ -2845,6 +2854,8 @@ typedef enum : NSUInteger {
|
|
|
|
|
|
|
|
|
|
|
|
if (lastInteraction.timestampForSorting > self.lastVisibleTimestamp) {
|
|
|
|
if (lastInteraction.timestampForSorting > self.lastVisibleTimestamp) {
|
|
|
|
shouldShowScrollDownButton = YES;
|
|
|
|
shouldShowScrollDownButton = YES;
|
|
|
|
|
|
|
|
} else if (isScrolledUp) {
|
|
|
|
|
|
|
|
shouldShowScrollDownButton = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3992,7 +4003,7 @@ typedef enum : NSUInteger {
|
|
|
|
[self presentViewController:controller animated:YES completion:nil];
|
|
|
|
[self presentViewController:controller animated:YES completion:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)textViewDidChangePosition
|
|
|
|
- (void)textViewDidChangeLayout
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OWSAssert([NSThread isMainThread]);
|
|
|
|
OWSAssert([NSThread isMainThread]);
|
|
|
|
|
|
|
|
|
|
|
@ -4006,6 +4017,8 @@ typedef enum : NSUInteger {
|
|
|
|
userInfo:nil
|
|
|
|
userInfo:nil
|
|
|
|
repeats:NO];
|
|
|
|
repeats:NO];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self ensureScrollDownButton];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)scrollToBottomImmediately
|
|
|
|
- (void)scrollToBottomImmediately
|
|
|
@ -4096,6 +4109,8 @@ typedef enum : NSUInteger {
|
|
|
|
// We want to show the "voice message" button if the text input is empty
|
|
|
|
// We want to show the "voice message" button if the text input is empty
|
|
|
|
// and the "send" button if it isn't.
|
|
|
|
// and the "send" button if it isn't.
|
|
|
|
[((OWSMessagesToolbarContentView *)self.inputToolbar.contentView)ensureEnabling];
|
|
|
|
[((OWSMessagesToolbarContentView *)self.inputToolbar.contentView)ensureEnabling];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self ensureScrollDownButton];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - UIScrollViewDelegate
|
|
|
|
#pragma mark - UIScrollViewDelegate
|
|
|
@ -4162,7 +4177,6 @@ typedef enum : NSUInteger {
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - OWSMessagesCollectionViewFlowLayoutDelegate
|
|
|
|
#pragma mark - OWSMessagesCollectionViewFlowLayoutDelegate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)shouldShowCellDecorationsAtIndexPath:(NSIndexPath *)indexPath
|
|
|
|
- (BOOL)shouldShowCellDecorationsAtIndexPath:(NSIndexPath *)indexPath
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
|
|
|
|
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
|
|
|
|