Fixing "jump" on loading MessagesViewController

This commit is contained in:
Frederic Jacobs 2014-12-24 11:50:07 +01:00
parent 333c920e0b
commit 224cea7773
3 changed files with 28 additions and 24 deletions

View File

@ -32,17 +32,17 @@ PODS:
- CocoaLumberjack/Core
- DJWActionSheet (1.0.4)
- HKDFKit (0.0.3)
- JSQMessagesViewController (6.1.0):
- JSQMessagesViewController (6.1.1):
- JSQSystemSoundPlayer (~> 2.0.0)
- JSQSystemSoundPlayer (2.0.0)
- libPhoneNumber-iOS (0.7.3)
- libPhoneNumber-iOS (0.7.5)
- Mantle (1.5.1):
- Mantle/extobjc (= 1.5.1)
- Mantle/extobjc (1.5.1)
- OpenSSL (1.0.110)
- PastelogKit (1.2):
- CocoaLumberjack (~> 1.9)
- ProtocolBuffers (1.9.2)
- ProtocolBuffers (1.9.3)
- SocketRocket (0.3.1-beta2)
- SQLCipher/common (3.1.0)
- SQLCipher/fts (3.1.0):
@ -81,7 +81,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
JSQMessagesViewController:
:commit: 8703ce020c86054ca32fbfdede0b4bded4428994
:commit: 6a30411791a52d1a605fa03733eab8ce47655b7f
:git: https://github.com/dtsbourg/JSQMessagesViewController
SocketRocket:
:commit: d0585af165
@ -94,13 +94,13 @@ SPEC CHECKSUMS:
CocoaLumberjack: 205769c032b5fef85b92472046bcc8b7e7c8a817
DJWActionSheet: d88b302d7c29523e1e9fb9b62cfac46f59bb90d9
HKDFKit: 5998cf1bbb611e7ecc6bd3eaaef8c7a7da7be949
JSQMessagesViewController: fb0f6e71c0a8009d210d6c7d73ba2b94bb77dc9b
JSQMessagesViewController: 554430bbaeb0b2dbed8d4aaa2bdf64559e67f353
JSQSystemSoundPlayer: c98443b1cbb3b45db09d0d3d6c2355cf78294981
libPhoneNumber-iOS: 98fc07d70c8fdb5e6a8e3442c37e97353065c20e
libPhoneNumber-iOS: 16b9556d7fdf4819eabeb7b7356fea3373fa47f9
Mantle: d7c5ac734579ec751c58fecbf56189853056c58c
OpenSSL: 72a82aa51b056ae5833307a3fef9b571f38ce11c
PastelogKit: 8bab71b1d187617a83e7124cffe9eb1a600e6695
ProtocolBuffers: a834d6fe4ae0cc94d081b864e4948bdd483ad228
ProtocolBuffers: e80f9e4fc401aec9d3c30be70db87fcd5f1cb880
SocketRocket: 9cbe08469513356cddc0afcab1ff160bd190296a
SQLCipher: 981110217eb93c2779c34fb59e646a1c1da918d8
SSKeychain: cc48bd3ad24fcd9125adb9e0d23dd50b8bbd08b9

2
Pods

@ -1 +1 @@
Subproject commit a8bebaaf7290b4aa90621250a3ed64d9cb47da21
Subproject commit e0662ba2d55acd60164b74d245983fb69017ceeb

View File

@ -129,6 +129,13 @@ typedef enum : NSUInteger {
name:UIApplicationDidEnterBackgroundNotification object:nil];
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.automaticallyScrollsToMostRecentMessage = YES;
[self scrollToBottomAnimated:NO];
}
- (void)startReadTimer{
self.readTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(markAllMessagesAsRead) userInfo:nil repeats:YES];
}
@ -155,11 +162,8 @@ typedef enum : NSUInteger {
-(void)initializeNavigationBar
{
self.title = self.thread.name;
if (!isGroupConversation && [self isRedPhoneReachable]) {
UIBarButtonItem * lockButton = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"lock"] style:UIBarButtonItemStylePlain target:self action:@selector(showFingerprint)];
UIBarButtonItem * callButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"call_tab"] style:UIBarButtonItemStylePlain target:self action:@selector(callAction)];
@ -192,7 +196,7 @@ typedef enum : NSUInteger {
self.collectionView.showsVerticalScrollIndicator = NO;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.automaticallyScrollsToMostRecentMessage = YES;
self.automaticallyScrollsToMostRecentMessage = NO;
self.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSizeZero;
self.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero;
@ -306,7 +310,7 @@ typedef enum : NSUInteger {
case TSErrorMessageAdapter:
return [self loadErrorMessageCellForMessage:msg atIndexPath:indexPath];
break;
default:
NSLog(@"Something went wrong");
return nil;
@ -379,9 +383,9 @@ typedef enum : NSUInteger {
}
else {
TSMessageAdapter *currentMessage = [self messageAtIndexPath:indexPath];
TSMessageAdapter *previousMessage = [self messageAtIndexPath:[NSIndexPath indexPathForItem:indexPath.row-1 inSection:indexPath.section]];
NSTimeInterval timeDifference = [currentMessage.date timeIntervalSinceDate:previousMessage.date];
if (timeDifference > kTSMessageSentDateShowTimeInterval) {
showDate = YES;
@ -392,10 +396,10 @@ typedef enum : NSUInteger {
-(NSAttributedString*)collectionView:(JSQMessagesCollectionView *)collectionView attributedTextForCellTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
if ([self showDateAtIndexPath:indexPath]) {
TSMessageAdapter *currentMessage = [self messageAtIndexPath:indexPath];
return [[JSQMessagesTimestampFormatter sharedFormatter] attributedTimestampForDate:currentMessage.date];
}
@ -452,7 +456,7 @@ typedef enum : NSUInteger {
name = name ? name : msg.senderId;
NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc]initWithString:name];
[attrStr appendAttributedString:[NSAttributedString attributedStringWithAttachment:textAttachment]];
return (NSAttributedString*)attrStr;
}
else {
@ -461,7 +465,7 @@ typedef enum : NSUInteger {
textAttachment.bounds = CGRectMake(0, 0, 11.0f, 10.0f);
NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc]initWithString:@"Delivered"];
[attrStr appendAttributedString:[NSAttributedString attributedStringWithAttachment:textAttachment]];
return (NSAttributedString*)attrStr;
}
}
@ -498,7 +502,7 @@ typedef enum : NSUInteger {
[self handleUnsentMessageTap:(TSOutgoingMessage*)interaction];
}
case TSIncomingMessageAdapter:{
BOOL isMediaMessage = [messageItem isMediaMessage];
if (isMediaMessage) {
@ -550,7 +554,7 @@ typedef enum : NSUInteger {
NSString *newKeyFingerprint = [message newIdentityKey];
NSString *messageString = [NSString stringWithFormat:@"Do you want to accept %@'s new identity key: %@", _thread.name, newKeyFingerprint];
NSArray *actions = @[@"Accept new identity key", @"Copy new identity key to pasteboard"];
[self.inputToolbar.contentView resignFirstResponder];
[DJWActionSheet showInView:self.tabBarController.view withTitle:messageString cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:actions tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) {
@ -565,7 +569,7 @@ typedef enum : NSUInteger {
case 0:
[message acceptNewIdentityKey];
break;
case 1:
[[UIPasteboard generalPasteboard] setString:newKeyFingerprint];
break;
@ -794,7 +798,7 @@ typedef enum : NSUInteger {
case 0:
DDLogDebug(@"update group picked");
[self performSegueWithIdentifier:kUpdateGroupSegueIdentifier sender:self];
break;
case 1:
DDLogDebug(@"leave group picket");