Messages view fixes

- Delivered tag
- Fix tap to resend recognizer
- Error messages layout

Reviewed-by: @FredericJacobs
This commit is contained in:
dtsbourg 2014-12-06 23:21:15 +01:00 committed by Frederic Jacobs
parent 32f1cb3755
commit 6868e2234d
6 changed files with 9 additions and 13 deletions

View File

@ -83,7 +83,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS: CHECKOUT OPTIONS:
JSQMessagesViewController: JSQMessagesViewController:
:commit: 82482a1fc560fb4f716babbe49a20cf9c0bc7fc3 :commit: bc976a04d906ab3e5316148ee66de172a6e370b2
:git: https://github.com/dtsbourg/JSQMessagesViewController :git: https://github.com/dtsbourg/JSQMessagesViewController
SocketRocket: SocketRocket:
:commit: d0585af165 :commit: d0585af165

2
Pods

@ -1 +1 @@
Subproject commit 0b6f683fbd2c3947a73ddb619ca4fe5ef4e6edcd Subproject commit 6641c0c61b183015950fb020a53a43a993bbb28f

View File

@ -12,7 +12,7 @@
@implementation TSErrorMessage @implementation TSErrorMessage
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread failedMessageType:(TSErrorMessageType)errorMessageType{ - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread failedMessageType:(TSErrorMessageType)errorMessageType{
self = [super initWithTimestamp:timestamp inThread:thread messageBody:@"" attachements:nil]; self = [super initWithTimestamp:timestamp inThread:thread messageBody:@"Placeholder for error message." attachements:nil];
if (self) { if (self) {
_errorType = errorMessageType; _errorType = errorMessageType;

View File

@ -11,7 +11,7 @@
@implementation TSInfoMessage @implementation TSInfoMessage
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSContactThread *)contact messageType:(TSInfoMessageType)infoMessage{ - (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSContactThread *)contact messageType:(TSInfoMessageType)infoMessage{
self = [super initWithTimestamp:timestamp inThread:contact messageBody:nil attachements:nil]; self = [super initWithTimestamp:timestamp inThread:contact messageBody:@"Placeholder for info message." attachements:nil];
if (self) { if (self) {
_messageType = infoMessage; _messageType = infoMessage;

View File

@ -65,6 +65,8 @@ typedef enum : NSUInteger {
@property (nonatomic, retain) NSTimer *readTimer; @property (nonatomic, retain) NSTimer *readTimer;
@property (nonatomic, retain) NSIndexPath *lastDeliveredMessageIndexPath;
@end @end
@implementation MessagesViewController @implementation MessagesViewController
@ -397,6 +399,7 @@ typedef enum : NSUInteger {
{ {
if ([self shouldShowMessageStatusAtIndexPath:indexPath]) if ([self shouldShowMessageStatusAtIndexPath:indexPath])
{ {
_lastDeliveredMessageIndexPath = indexPath;
NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init]; NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
textAttachment.bounds = CGRectMake(0, 0, 11.0f, 10.0f); textAttachment.bounds = CGRectMake(0, 0, 11.0f, 10.0f);
NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc]initWithString:@"Delivered"]; NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc]initWithString:@"Delivered"];
@ -444,7 +447,7 @@ typedef enum : NSUInteger {
} }
} }
BOOL isUnsent = messageItem.messageState == TSOutgoingMessageStateUnsent || messageItem.messageState == TSOutgoingMessageStateAttemptingOut; BOOL isUnsent = messageItem.messageState == TSOutgoingMessageStateAttemptingOut && [messageItem.senderId isEqualToString:self.senderId];
if (isMessage && isUnsent) if (isMessage && isUnsent)
{ {
@ -645,7 +648,7 @@ typedef enum : NSUInteger {
} }
case YapDatabaseViewChangeUpdate : case YapDatabaseViewChangeUpdate :
{ {
[self.collectionView reloadItemsAtIndexPaths:@[ rowChange.indexPath ]]; [self.collectionView reloadItemsAtIndexPaths:@[ rowChange.indexPath , _lastDeliveredMessageIndexPath]];
break; break;
} }
} }

View File

@ -15,13 +15,6 @@
#define ME_MESSAGE_IDENTIFIER @"Me"; #define ME_MESSAGE_IDENTIFIER @"Me";
typedef NS_ENUM(NSInteger, TSMessageAdapterType) {
TSIncomingMessageAdapter,
TSOutgoingMessageAdapter,
TSCallAdapter,
TSInfoMessageAdapter,
TSErrorMessageAdapter
};
@interface TSMessageAdapter : NSObject <JSQMessageData> @interface TSMessageAdapter : NSObject <JSQMessageData>