MessagesVC: Scrolls to bottom and fixes jumpiness
This commit is contained in:
parent
a93b111458
commit
5961c635e0
|
@ -81,7 +81,7 @@ EXTERNAL SOURCES:
|
||||||
|
|
||||||
CHECKOUT OPTIONS:
|
CHECKOUT OPTIONS:
|
||||||
JSQMessagesViewController:
|
JSQMessagesViewController:
|
||||||
:commit: 6a30411791a52d1a605fa03733eab8ce47655b7f
|
:commit: 84d1b659f350ac3e10464d44b87243fa4622acf4
|
||||||
:git: https://github.com/dtsbourg/JSQMessagesViewController
|
:git: https://github.com/dtsbourg/JSQMessagesViewController
|
||||||
SocketRocket:
|
SocketRocket:
|
||||||
:commit: d0585af165
|
:commit: d0585af165
|
||||||
|
|
|
@ -45,5 +45,12 @@
|
||||||
{
|
{
|
||||||
return [UIColor colorWithRed:195.f/255.f green:0 blue:22.f/255.f alpha:1.f];
|
return [UIColor colorWithRed:195.f/255.f green:0 blue:22.f/255.f alpha:1.f];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (UIColor *) ows_lightBackgroundColor
|
||||||
|
{
|
||||||
|
return [UIColor colorWithRed:242.f/255.f green:242.f/255.f blue:242.f/255.f alpha:1.f];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ typedef enum : NSUInteger {
|
||||||
-(void)viewWillAppear:(BOOL)animated
|
-(void)viewWillAppear:(BOOL)animated
|
||||||
{
|
{
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
|
self.automaticallyScrollsToMostRecentMessage = YES;
|
||||||
[self scrollToBottomAnimated:NO];
|
[self scrollToBottomAnimated:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +156,7 @@ typedef enum : NSUInteger {
|
||||||
- (void)viewDidAppear:(BOOL)animated{
|
- (void)viewDidAppear:(BOOL)animated{
|
||||||
[super viewDidAppear:animated];
|
[super viewDidAppear:animated];
|
||||||
[self startReadTimer];
|
[self startReadTimer];
|
||||||
|
[self scrollToBottomAnimated:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated{
|
- (void)viewWillDisappear:(BOOL)animated{
|
||||||
|
@ -216,7 +218,7 @@ typedef enum : NSUInteger {
|
||||||
self.collectionView.showsVerticalScrollIndicator = NO;
|
self.collectionView.showsVerticalScrollIndicator = NO;
|
||||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||||
|
|
||||||
self.automaticallyScrollsToMostRecentMessage = YES;
|
self.automaticallyScrollsToMostRecentMessage = NO;
|
||||||
|
|
||||||
self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeZero;
|
self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeZero;
|
||||||
self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero;
|
self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero;
|
||||||
|
@ -260,14 +262,6 @@ typedef enum : NSUInteger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - JSQMessage custom methods
|
|
||||||
|
|
||||||
-(void)updateMessageStatus:(JSQMessage*)message {
|
|
||||||
if ([message.senderId isEqualToString:self.senderId]){
|
|
||||||
message.status = kMessageReceived;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - JSQMessagesViewController method overrides
|
#pragma mark - JSQMessagesViewController method overrides
|
||||||
|
|
||||||
- (void)didPressSendButton:(UIButton *)button
|
- (void)didPressSendButton:(UIButton *)button
|
||||||
|
@ -502,7 +496,7 @@ typedef enum : NSUInteger {
|
||||||
return 16.0f;
|
return 16.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (msg.messageType == TSOutgoingMessageAdapter) {
|
else if ([self shouldShowMessageStatusAtIndexPath:indexPath]) {
|
||||||
return 16.0f;
|
return 16.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,7 +816,9 @@ typedef enum : NSUInteger {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[self.collectionView performBatchUpdates:^{
|
[self.collectionView performBatchUpdates:^{
|
||||||
|
|
||||||
for (YapDatabaseViewRowChange *rowChange in messageRowChanges)
|
for (YapDatabaseViewRowChange *rowChange in messageRowChanges)
|
||||||
{
|
{
|
||||||
switch (rowChange.type)
|
switch (rowChange.type)
|
||||||
|
@ -855,8 +851,9 @@ typedef enum : NSUInteger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} completion:^(BOOL finished) {
|
} completion:^(BOOL finished) {
|
||||||
[self finishReceivingMessage];
|
[self scrollToBottomAnimated:YES];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue