Merge branch 'charlesmchen/messageViewScrollStateRevisited'

pull/1/head
Matthew Chen 7 years ago
commit 70cbfb9ec0

@ -139,7 +139,7 @@ CHECKOUT OPTIONS:
:commit: 6e9d5e8c3dc87e397b4b7485172507b0990a22dd
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
JSQMessagesViewController:
:commit: 9e452ee59cbcebf2c67f0dc499988b6725de776e
:commit: 868cf70fae0f3b54c3cfa7773ef03578d209b668
:git: https://github.com/WhisperSystems/JSQMessagesViewController.git
OpenSSL:
:commit: b2d3c149102032a09aefbfb470885db4aa83efad

@ -2580,11 +2580,7 @@
"DEBUG=1",
"$(inherited)",
);
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = (
"DEBUG=1",
"$(inherited)",
"SSK_BUILDING_FOR_TESTS=1",
);
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1 $(inherited) SSK_BUILDING_FOR_TESTS=1";
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

@ -243,6 +243,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
@property (nonatomic) BOOL isViewVisible;
@property (nonatomic) BOOL isAppInBackground;
@property (nonatomic) BOOL shouldObserveDBModifications;
@property (nonatomic) BOOL viewHasEverAppeared;
@end
@ -639,7 +640,11 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
[((OWSMessagesToolbarContentView *)self.inputToolbar.contentView)ensureSubviews];
[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
@ -1059,6 +1064,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
[ProfileFetcherJob runWithThread:self.thread networkManager:self.networkManager];
[self markVisibleMessagesAsRead];
self.viewHasEverAppeared = YES;
}
- (void)viewWillDisappear:(BOOL)animated
@ -3506,6 +3513,14 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
- (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;
return (self.collectionView.contentOffset.y + self.collectionView.bounds.size.height + kIsAtBottomTolerancePts
>= self.collectionView.contentSize.height);
@ -4149,6 +4164,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
- (void)scrollToBottomAnimated:(BOOL)animated
{
OWSAssert([NSThread isMainThread]);
if (self.isUserScrolling) {
return;

Loading…
Cancel
Save