|
|
@ -243,6 +243,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
@property (nonatomic) BOOL isViewVisible;
|
|
|
|
@property (nonatomic) BOOL isViewVisible;
|
|
|
|
@property (nonatomic) BOOL isAppInBackground;
|
|
|
|
@property (nonatomic) BOOL isAppInBackground;
|
|
|
|
@property (nonatomic) BOOL shouldObserveDBModifications;
|
|
|
|
@property (nonatomic) BOOL shouldObserveDBModifications;
|
|
|
|
|
|
|
|
@property (nonatomic) BOOL viewHasEverAppeared;
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
@ -639,7 +640,11 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
[((OWSMessagesToolbarContentView *)self.inputToolbar.contentView)ensureSubviews];
|
|
|
|
[((OWSMessagesToolbarContentView *)self.inputToolbar.contentView)ensureSubviews];
|
|
|
|
|
|
|
|
|
|
|
|
[self.view layoutSubviews];
|
|
|
|
[self.view layoutSubviews];
|
|
|
|
[self scrollToDefaultPosition];
|
|
|
|
|
|
|
|
|
|
|
|
// We want to set the initial scroll state the first time we enter the view.
|
|
|
|
|
|
|
|
if (!self.viewHasEverAppeared) {
|
|
|
|
|
|
|
|
[self scrollToDefaultPosition];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (NSIndexPath *_Nullable)indexPathOfUnreadMessagesIndicator
|
|
|
|
- (NSIndexPath *_Nullable)indexPathOfUnreadMessagesIndicator
|
|
|
@ -1059,6 +1064,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
[ProfileFetcherJob runWithThread:self.thread networkManager:self.networkManager];
|
|
|
|
[ProfileFetcherJob runWithThread:self.thread networkManager:self.networkManager];
|
|
|
|
|
|
|
|
|
|
|
|
[self markVisibleMessagesAsRead];
|
|
|
|
[self markVisibleMessagesAsRead];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.viewHasEverAppeared = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated
|
|
|
@ -3506,6 +3513,14 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)isScrolledToBottom
|
|
|
|
- (BOOL)isScrolledToBottom
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (self.collectionView.contentSize.height < 1) {
|
|
|
|
|
|
|
|
// If the collection view hasn't determined its content size yet,
|
|
|
|
|
|
|
|
// scroll state is not yet coherent. Therefore we can't (and don't
|
|
|
|
|
|
|
|
// need to) determine whether we're "scrolled to the bottom" until
|
|
|
|
|
|
|
|
// the collection view has determined its content size.
|
|
|
|
|
|
|
|
return NO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const CGFloat kIsAtBottomTolerancePts = 5;
|
|
|
|
const CGFloat kIsAtBottomTolerancePts = 5;
|
|
|
|
return (self.collectionView.contentOffset.y + self.collectionView.bounds.size.height + kIsAtBottomTolerancePts
|
|
|
|
return (self.collectionView.contentOffset.y + self.collectionView.bounds.size.height + kIsAtBottomTolerancePts
|
|
|
|
>= self.collectionView.contentSize.height);
|
|
|
|
>= self.collectionView.contentSize.height);
|
|
|
@ -4149,6 +4164,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
|
|
|
|
|
|
|
- (void)scrollToBottomAnimated:(BOOL)animated
|
|
|
|
- (void)scrollToBottomAnimated:(BOOL)animated
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
OWSAssert([NSThread isMainThread]);
|
|
|
|
|
|
|
|
|
|
|
|
if (self.isUserScrolling) {
|
|
|
|
if (self.isUserScrolling) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|