format objc.
This is part of unforking JSQMVC, but I'm only reformatting files otherwise changed rather than reformatting the entire project for git sanity. This is intentionally a second commit so we can separate formatting changes from code changes * brace should drop after method definition (this is common across almost all objc projects, and allows you to quickly differentiate multi-line method signatures from their implementation. * aligning consecutive assignments ongoingly muddies git history // FREEBIE
This commit is contained in:
parent
4d320d6015
commit
933281f234
|
@ -1,14 +1,10 @@
|
||||||
---
|
---
|
||||||
BasedOnStyle: Chromium
|
BasedOnStyle: WebKit
|
||||||
AlignTrailingComments: true
|
AllowShortFunctionsOnASingleLine: false
|
||||||
AlignConsecutiveAssignments: true
|
|
||||||
AllowShortIfStatementsOnASingleLine: false
|
|
||||||
BreakBeforeBraces: Attach
|
|
||||||
BinPackArguments: false
|
BinPackArguments: false
|
||||||
BinPackParameters: false
|
BinPackParameters: false
|
||||||
ColumnLimit: 120
|
ColumnLimit: 120
|
||||||
IndentWidth: 4
|
IndentCaseLabels: true
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
|
||||||
MaxEmptyLinesToKeep: 2
|
MaxEmptyLinesToKeep: 2
|
||||||
ObjCSpaceAfterProperty: true
|
ObjCSpaceAfterProperty: true
|
||||||
ObjCSpaceBeforeProtocolList: true
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
typedef enum : NSUInteger {
|
typedef enum : NSUInteger {
|
||||||
kCallOutgoing = 1,
|
kCallOutgoing = 1,
|
||||||
kCallIncoming = 2,
|
kCallIncoming = 2,
|
||||||
kCallMissed = 3,
|
kCallMissed = 3,
|
||||||
kGroupUpdateJoin = 4,
|
kGroupUpdateJoin = 4,
|
||||||
kGroupUpdateLeft = 5,
|
kGroupUpdateLeft = 5,
|
||||||
kGroupUpdate = 6
|
kGroupUpdate = 6
|
||||||
|
@ -39,7 +39,7 @@ typedef enum : NSUInteger {
|
||||||
@property (copy, nonatomic, readonly) NSDate *date;
|
@property (copy, nonatomic, readonly) NSDate *date;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the call status
|
* Returns the call status
|
||||||
* @see CallStatus
|
* @see CallStatus
|
||||||
*/
|
*/
|
||||||
@property (nonatomic) CallStatus status;
|
@property (nonatomic) CallStatus status;
|
||||||
|
@ -61,16 +61,16 @@ typedef enum : NSUInteger {
|
||||||
@property (nonatomic, copy) NSString *detailString;
|
@property (nonatomic, copy) NSString *detailString;
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Initialization
|
#pragma mark - Initialization
|
||||||
|
|
||||||
- (instancetype)initWithCallerId:(NSString *)callerId
|
- (instancetype)initWithCallerId:(NSString *)callerId
|
||||||
callerDisplayName:(NSString *)callerDisplayName
|
callerDisplayName:(NSString *)callerDisplayName
|
||||||
date:(NSDate *)date
|
date:(NSDate *)date
|
||||||
status:(CallStatus)status
|
status:(CallStatus)status
|
||||||
displayString:(NSString*)detailString;
|
displayString:(NSString *)detailString;
|
||||||
|
|
||||||
-(NSString*)dateText;
|
- (NSString *)dateText;
|
||||||
|
|
||||||
-(UIImage*)thumbnailImage;
|
- (UIImage *)thumbnailImage;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -14,15 +14,15 @@
|
||||||
|
|
||||||
#pragma mark - Initialzation
|
#pragma mark - Initialzation
|
||||||
|
|
||||||
-(instancetype)initWithCallerId:(NSString *)senderId
|
- (instancetype)initWithCallerId:(NSString *)senderId
|
||||||
callerDisplayName:(NSString *)senderDisplayName
|
callerDisplayName:(NSString *)senderDisplayName
|
||||||
date:(NSDate *)date
|
date:(NSDate *)date
|
||||||
status:(CallStatus)status
|
status:(CallStatus)status
|
||||||
displayString:(NSString *)detailString
|
displayString:(NSString *)detailString
|
||||||
{
|
{
|
||||||
NSParameterAssert(senderId != nil);
|
NSParameterAssert(senderId != nil);
|
||||||
NSParameterAssert(senderDisplayName != nil);
|
NSParameterAssert(senderDisplayName != nil);
|
||||||
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_senderId = [senderId copy];
|
_senderId = [senderId copy];
|
||||||
|
@ -31,25 +31,28 @@
|
||||||
_status = status;
|
_status = status;
|
||||||
_messageType = TSCallAdapter;
|
_messageType = TSCallAdapter;
|
||||||
_detailString = [detailString stringByAppendingFormat:@" "];
|
_detailString = [detailString stringByAppendingFormat:@" "];
|
||||||
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id)init
|
- (id)init
|
||||||
{
|
{
|
||||||
NSAssert(NO,@"%s is not a valid initializer for %@. Use %@ instead", __PRETTY_FUNCTION__, [self class], NSStringFromSelector(@selector(initWithCallerId:callerDisplayName:date:status:displayString:)));
|
NSAssert(NO,
|
||||||
|
@"%s is not a valid initializer for %@. Use %@ instead",
|
||||||
|
__PRETTY_FUNCTION__,
|
||||||
|
[self class],
|
||||||
|
NSStringFromSelector(@selector(initWithCallerId:callerDisplayName:date:status:displayString:)));
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
_senderId = nil;
|
_senderId = nil;
|
||||||
_senderDisplayName = nil;
|
_senderDisplayName = nil;
|
||||||
_date = nil;
|
_date = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSString*)dateText
|
- (NSString *)dateText
|
||||||
{
|
{
|
||||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
dateFormatter.timeStyle = NSDateFormatterShortStyle;
|
dateFormatter.timeStyle = NSDateFormatterShortStyle;
|
||||||
|
@ -58,9 +61,10 @@
|
||||||
return [dateFormatter stringFromDate:_date];
|
return [dateFormatter stringFromDate:_date];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(UIImage*)thumbnailImage {
|
- (UIImage *)thumbnailImage
|
||||||
|
{
|
||||||
// This relies on those assets being in the project
|
// This relies on those assets being in the project
|
||||||
if(!_useThumbnail) {
|
if (!_useThumbnail) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
switch (_status) {
|
switch (_status) {
|
||||||
|
@ -86,49 +90,47 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - NSObject
|
#pragma mark - NSObject
|
||||||
|
|
||||||
-(BOOL)isEqual:(id)object
|
- (BOOL)isEqual:(id)object
|
||||||
{
|
{
|
||||||
if (self==object) {
|
if (self == object) {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![object isKindOfClass:[self class]])
|
if (![object isKindOfClass:[self class]]) {
|
||||||
{
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSQCall * aCall = (JSQCall*)object;
|
JSQCall *aCall = (JSQCall *)object;
|
||||||
|
|
||||||
return [self.senderId isEqualToString:aCall.senderId]
|
return [self.senderId isEqualToString:aCall.senderId] &&
|
||||||
&& [self.senderDisplayName isEqualToString:aCall.senderDisplayName]
|
[self.senderDisplayName isEqualToString:aCall.senderDisplayName]
|
||||||
&& ([self.date compare:aCall.date] == NSOrderedSame)
|
&& ([self.date compare:aCall.date] == NSOrderedSame) && self.status == aCall.status;
|
||||||
&& self.status == aCall.status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSUInteger)hash
|
- (NSUInteger)hash
|
||||||
{
|
{
|
||||||
return self.senderId.hash ^ self.date.hash;
|
return self.senderId.hash ^ self.date.hash;
|
||||||
}
|
}
|
||||||
|
- (NSString *)description
|
||||||
-(NSString*)description
|
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@>",
|
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@>",
|
||||||
[self class], self.senderId, self.senderDisplayName, self.date];
|
[self class],
|
||||||
|
self.senderId,
|
||||||
|
self.senderDisplayName,
|
||||||
|
self.date];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - JSQMessageData
|
#pragma mark - JSQMessageData
|
||||||
|
|
||||||
//TODO I'm not sure this is right. It affects bubble rendering.
|
// TODO I'm not sure this is right. It affects bubble rendering.
|
||||||
- (BOOL)isMediaMessage {
|
- (BOOL)isMediaMessage
|
||||||
|
{
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - NSCoding
|
#pragma mark - NSCoding
|
||||||
|
|
||||||
-(instancetype)initWithCoder:(NSCoder *)aDecoder
|
- (instancetype)initWithCoder:(NSCoder *)aDecoder
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
|
@ -150,21 +152,21 @@
|
||||||
|
|
||||||
#pragma mark - NSCopying
|
#pragma mark - NSCopying
|
||||||
|
|
||||||
-(instancetype)copyWithZone:(NSZone *)zone
|
- (instancetype)copyWithZone:(NSZone *)zone
|
||||||
{
|
{
|
||||||
return [[[self class] allocWithZone:zone]initWithCallerId:self.senderId
|
return [[[self class] allocWithZone:zone] initWithCallerId:self.senderId
|
||||||
callerDisplayName:self.senderDisplayName
|
callerDisplayName:self.senderDisplayName
|
||||||
date:self.date
|
date:self.date
|
||||||
status:self.status
|
status:self.status
|
||||||
displayString:self.detailString];
|
displayString:self.detailString];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger)messageHash{
|
- (NSUInteger)messageHash
|
||||||
|
{
|
||||||
return self.hash;
|
return self.hash;
|
||||||
}
|
}
|
||||||
|
- (NSString *)text
|
||||||
- (NSString *)text{
|
{
|
||||||
return _detailString;
|
return _detailString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
// Copyright (c) 2014 Hexed Bits. All rights reserved.
|
// Copyright (c) 2014 Hexed Bits. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "JSQMessageData.h"
|
#import "JSQMessageData.h"
|
||||||
#import "TSMessageAdapter.h"
|
#import "TSMessageAdapter.h"
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
/* JSQDisplayed message is the parent class for displaying information to the user
|
/* JSQDisplayed message is the parent class for displaying information to the user
|
||||||
* from within the conversation view. Do not use directly :
|
* from within the conversation view. Do not use directly :
|
||||||
|
@ -38,8 +38,8 @@
|
||||||
|
|
||||||
#pragma mark - Initializer
|
#pragma mark - Initializer
|
||||||
|
|
||||||
-(instancetype)initWithSenderId:(NSString*)senderId
|
- (instancetype)initWithSenderId:(NSString *)senderId
|
||||||
senderDisplayName:(NSString*)senderDisplayName
|
senderDisplayName:(NSString *)senderDisplayName
|
||||||
date:(NSDate*)date;
|
date:(NSDate *)date;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -10,24 +10,28 @@
|
||||||
|
|
||||||
@implementation JSQDisplayedMessage
|
@implementation JSQDisplayedMessage
|
||||||
|
|
||||||
-(id)init
|
- (id)init
|
||||||
{
|
{
|
||||||
NSAssert(NO,@"%s is not a valid initializer for %@. Use %@ instead", __PRETTY_FUNCTION__, [self class], NSStringFromSelector(@selector(initWithSenderId:senderDisplayName:date:)));
|
NSAssert(NO,
|
||||||
|
@"%s is not a valid initializer for %@. Use %@ instead",
|
||||||
|
__PRETTY_FUNCTION__,
|
||||||
|
[self class],
|
||||||
|
NSStringFromSelector(@selector(initWithSenderId:senderDisplayName:date:)));
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(instancetype)initWithSenderId:(NSString*)senderId
|
- (instancetype)initWithSenderId:(NSString *)senderId
|
||||||
senderDisplayName:(NSString*)senderDisplayName
|
senderDisplayName:(NSString *)senderDisplayName
|
||||||
date:(NSDate*)date
|
date:(NSDate *)date
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
_senderId = [senderId copy];
|
_senderId = [senderId copy];
|
||||||
_senderDisplayName = [senderDisplayName copy];
|
_senderDisplayName = [senderDisplayName copy];
|
||||||
_date = [date copy];
|
_date = [date copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#import "JSQDisplayedMessage.h"
|
#import "JSQDisplayedMessage.h"
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, JSQErrorMessageType){
|
typedef NS_ENUM(NSInteger, JSQErrorMessageType) {
|
||||||
JSQErrorMessageNoSession,
|
JSQErrorMessageNoSession,
|
||||||
JSQErrorMessageWrongTrustedIdentityKey,
|
JSQErrorMessageWrongTrustedIdentityKey,
|
||||||
JSQErrorMessageInvalidKeyException,
|
JSQErrorMessageInvalidKeyException,
|
||||||
|
@ -27,10 +27,10 @@ typedef NS_ENUM(NSInteger, JSQErrorMessageType){
|
||||||
#pragma mark - Initialization
|
#pragma mark - Initialization
|
||||||
|
|
||||||
- (instancetype)initWithErrorType:(JSQErrorMessageType)messageType
|
- (instancetype)initWithErrorType:(JSQErrorMessageType)messageType
|
||||||
senderId:(NSString*)senderId
|
senderId:(NSString *)senderId
|
||||||
senderDisplayName:(NSString*)senderDisplayName
|
senderDisplayName:(NSString *)senderDisplayName
|
||||||
date:(NSDate*)date;
|
date:(NSDate *)date;
|
||||||
|
|
||||||
- (NSString*)text;
|
- (NSString *)text;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -16,16 +16,16 @@
|
||||||
date:(NSDate *)date
|
date:(NSDate *)date
|
||||||
{
|
{
|
||||||
self = [super initWithSenderId:senderId senderDisplayName:senderDisplayName date:date];
|
self = [super initWithSenderId:senderId senderDisplayName:senderDisplayName date:date];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
_errorMessageType = messageType;
|
_errorMessageType = messageType;
|
||||||
_messageType = TSErrorMessageAdapter;
|
_messageType = TSErrorMessageAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)text
|
- (NSString *)text
|
||||||
{
|
{
|
||||||
switch (self.errorMessageType) {
|
switch (self.errorMessageType) {
|
||||||
case JSQErrorMessageNoSession:
|
case JSQErrorMessageNoSession:
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
case JSQErrorMessageInvalidVersion:
|
case JSQErrorMessageInvalidVersion:
|
||||||
return [NSString stringWithFormat:@"Error: Invalid version for contact %@.", self.senderDisplayName];
|
return [NSString stringWithFormat:@"Error: Invalid version for contact %@.", self.senderDisplayName];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil;
|
return nil;
|
||||||
break;
|
break;
|
||||||
|
@ -61,13 +61,17 @@
|
||||||
return self.senderId.hash ^ self.date.hash;
|
return self.senderId.hash ^ self.date.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)description
|
- (NSString *)description
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>",
|
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>",
|
||||||
[self class], self.senderId, self.senderDisplayName, self.date, self.errorMessageType];
|
[self class],
|
||||||
|
self.senderId,
|
||||||
|
self.senderDisplayName,
|
||||||
|
self.date,
|
||||||
|
self.errorMessageType];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(TSMessageAdapterType)messageType
|
- (TSMessageAdapterType)messageType
|
||||||
{
|
{
|
||||||
return TSErrorMessageAdapter;
|
return TSErrorMessageAdapter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#import "JSQDisplayedMessage.h"
|
#import "JSQDisplayedMessage.h"
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, JSQInfoMessageType){
|
typedef NS_ENUM(NSInteger, JSQInfoMessageType) {
|
||||||
JSQInfoMessageTypeSessionDidEnd,
|
JSQInfoMessageTypeSessionDidEnd,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,11 +21,11 @@ typedef NS_ENUM(NSInteger, JSQInfoMessageType){
|
||||||
#pragma mark - Initialization
|
#pragma mark - Initialization
|
||||||
|
|
||||||
- (instancetype)initWithInfoType:(JSQInfoMessageType)messageType
|
- (instancetype)initWithInfoType:(JSQInfoMessageType)messageType
|
||||||
senderId:(NSString*)senderId
|
senderId:(NSString *)senderId
|
||||||
senderDisplayName:(NSString*)senderDisplayName
|
senderDisplayName:(NSString *)senderDisplayName
|
||||||
date:(NSDate*)date;
|
date:(NSDate *)date;
|
||||||
|
|
||||||
- (NSString*)text;
|
- (NSString *)text;
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -16,39 +16,43 @@
|
||||||
date:(NSDate *)date
|
date:(NSDate *)date
|
||||||
{
|
{
|
||||||
//@discussion: NSParameterAssert() ?
|
//@discussion: NSParameterAssert() ?
|
||||||
|
|
||||||
self = [super initWithSenderId:senderId senderDisplayName:senderDisplayName date:date];
|
self = [super initWithSenderId:senderId senderDisplayName:senderDisplayName date:date];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
_infoMessageType = messageType;
|
_infoMessageType = messageType;
|
||||||
_messageType = TSInfoMessageAdapter;
|
_messageType = TSInfoMessageAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSString*)text
|
- (NSString *)text
|
||||||
{
|
{
|
||||||
switch (self.infoMessageType) {
|
switch (self.infoMessageType) {
|
||||||
case JSQInfoMessageTypeSessionDidEnd:
|
case JSQInfoMessageTypeSessionDidEnd:
|
||||||
return [NSString stringWithFormat:@"Session with %@ ended.", self.senderDisplayName];
|
return [NSString stringWithFormat:@"Session with %@ ended.", self.senderDisplayName];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil;
|
return nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSUInteger)hash
|
- (NSUInteger)hash
|
||||||
{
|
{
|
||||||
return self.senderId.hash ^ self.date.hash;
|
return self.senderId.hash ^ self.date.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSString*)description
|
- (NSString *)description
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>",
|
return [NSString stringWithFormat:@"<%@: senderId=%@, senderDisplayName=%@, date=%@, type=%ld>",
|
||||||
[self class], self.senderId, self.senderDisplayName, self.date, self.infoMessageType];
|
[self class],
|
||||||
|
self.senderId,
|
||||||
|
self.senderDisplayName,
|
||||||
|
self.date,
|
||||||
|
self.infoMessageType];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "OWSMessagesBubblesSizeCalculator.h"
|
#import "OWSMessagesBubblesSizeCalculator.h"
|
||||||
#import "TSMessageAdapter.h"
|
|
||||||
#import "JSQDisplayedMessageCollectionViewCell.h"
|
#import "JSQDisplayedMessageCollectionViewCell.h"
|
||||||
|
#import "TSMessageAdapter.h"
|
||||||
|
|
||||||
@implementation OWSMessagesBubblesSizeCalculator
|
@implementation OWSMessagesBubblesSizeCalculator
|
||||||
|
|
||||||
|
@ -27,13 +27,10 @@
|
||||||
atIndexPath:(NSIndexPath *)indexPath
|
atIndexPath:(NSIndexPath *)indexPath
|
||||||
withLayout:(JSQMessagesCollectionViewFlowLayout *)layout
|
withLayout:(JSQMessagesCollectionViewFlowLayout *)layout
|
||||||
{
|
{
|
||||||
CGSize superSize = [super messageBubbleSizeForMessageData:messageData
|
CGSize superSize = [super messageBubbleSizeForMessageData:messageData atIndexPath:indexPath withLayout:layout];
|
||||||
atIndexPath:indexPath
|
|
||||||
withLayout:layout];
|
|
||||||
|
|
||||||
TSMessageAdapter *message = (TSMessageAdapter *)messageData;
|
TSMessageAdapter *message = (TSMessageAdapter *)messageData;
|
||||||
if (message.messageType == TSInfoMessageAdapter ||
|
if (message.messageType == TSInfoMessageAdapter || message.messageType == TSErrorMessageAdapter) {
|
||||||
message.messageType == TSErrorMessageAdapter) {
|
|
||||||
|
|
||||||
// Prevent cropping message text by accounting for message container/icon
|
// Prevent cropping message text by accounting for message container/icon
|
||||||
superSize.height = OWSDisplayedMessageCellHeight;
|
superSize.height = OWSDisplayedMessageCellHeight;
|
||||||
|
|
|
@ -22,7 +22,7 @@ typedef NS_ENUM(NSInteger, TSMessageAdapterType) {
|
||||||
TSInfoMessageAdapter,
|
TSInfoMessageAdapter,
|
||||||
TSErrorMessageAdapter,
|
TSErrorMessageAdapter,
|
||||||
TSMediaAttachmentAdapter,
|
TSMediaAttachmentAdapter,
|
||||||
TSGenericTextMessageAdapter, //Used when message direction is unknown (outgoing or incoming)
|
TSGenericTextMessageAdapter, // Used when message direction is unknown (outgoing or incoming)
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface TSMessageAdapter : NSObject <JSQMessageData>
|
@interface TSMessageAdapter : NSObject <JSQMessageData>
|
||||||
|
|
|
@ -254,7 +254,7 @@
|
||||||
{
|
{
|
||||||
if (self.isMediaMessage) {
|
if (self.isMediaMessage) {
|
||||||
return [self.mediaItem mediaHash];
|
return [self.mediaItem mediaHash];
|
||||||
} else {
|
} else {
|
||||||
return self.identifier;
|
return self.identifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
@interface JSQCallCollectionViewCell : JSQMessagesCollectionViewCell
|
@interface JSQCallCollectionViewCell : JSQMessagesCollectionViewCell
|
||||||
|
|
||||||
//TODO can we use an existing label from JSQMessagesCollectionViewCell?
|
// TODO can we use an existing label from JSQMessagesCollectionViewCell?
|
||||||
@property (weak, nonatomic, readonly) JSQMessagesLabel *cellLabel;
|
@property (weak, nonatomic, readonly) JSQMessagesLabel *cellLabel;
|
||||||
|
|
||||||
@property (weak, nonatomic, readonly) UIImageView *outgoingCallImageView;
|
@property (weak, nonatomic, readonly) UIImageView *outgoingCallImageView;
|
||||||
|
|
|
@ -34,27 +34,27 @@
|
||||||
|
|
||||||
#pragma mark - Initializer
|
#pragma mark - Initializer
|
||||||
|
|
||||||
-(void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
[super awakeFromNib];
|
[super awakeFromNib];
|
||||||
|
|
||||||
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
|
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||||
|
|
||||||
self.backgroundColor = [UIColor whiteColor];
|
self.backgroundColor = [UIColor whiteColor];
|
||||||
|
|
||||||
self.cellLabel.textAlignment = NSTextAlignmentCenter;
|
self.cellLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
self.cellLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14.0f];
|
self.cellLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14.0f];
|
||||||
self.cellLabel.textColor = [UIColor lightGrayColor];
|
self.cellLabel.textColor = [UIColor lightGrayColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
_cellLabel = nil;
|
_cellLabel = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Collection view cell
|
#pragma mark - Collection view cell
|
||||||
|
|
||||||
-(void)prepareForReuse
|
- (void)prepareForReuse
|
||||||
{
|
{
|
||||||
[super prepareForReuse];
|
[super prepareForReuse];
|
||||||
self.cellLabel.text = nil;
|
self.cellLabel.text = nil;
|
||||||
|
|
|
@ -6,16 +6,16 @@
|
||||||
// Copyright (c) 2014 Hexed Bits. All rights reserved.
|
// Copyright (c) 2014 Hexed Bits. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import <JSQMessagesViewController/JSQMessagesCollectionViewCell.h>
|
#import <JSQMessagesViewController/JSQMessagesCollectionViewCell.h>
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
static const CGFloat OWSDisplayedMessageCellHeight = 70.0f;
|
static const CGFloat OWSDisplayedMessageCellHeight = 70.0f;
|
||||||
|
|
||||||
@interface JSQDisplayedMessageCollectionViewCell : JSQMessagesCollectionViewCell
|
@interface JSQDisplayedMessageCollectionViewCell : JSQMessagesCollectionViewCell
|
||||||
|
|
||||||
// TODO can we use existing label from superclass?
|
// TODO can we use existing label from superclass?
|
||||||
@property (weak, nonatomic, readonly) JSQMessagesLabel * cellLabel;
|
@property (weak, nonatomic, readonly) JSQMessagesLabel *cellLabel;
|
||||||
@property (weak, nonatomic, readonly) UIImageView * headerImageView;
|
@property (weak, nonatomic, readonly) UIImageView *headerImageView;
|
||||||
@property (strong, nonatomic, readonly) UIView *textContainer;
|
@property (strong, nonatomic, readonly) UIView *textContainer;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
@interface JSQDisplayedMessageCollectionViewCell ()
|
@interface JSQDisplayedMessageCollectionViewCell ()
|
||||||
|
|
||||||
@property(weak, nonatomic) IBOutlet JSQMessagesLabel* cellLabel;
|
@property (weak, nonatomic) IBOutlet JSQMessagesLabel *cellLabel;
|
||||||
@property (weak, nonatomic) IBOutlet UIImageView* headerImageView;
|
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
|
||||||
@property (strong, nonatomic) IBOutlet UIView *textContainer;
|
@property (strong, nonatomic) IBOutlet UIView *textContainer;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -34,14 +34,14 @@
|
||||||
|
|
||||||
#pragma mark - Initializer
|
#pragma mark - Initializer
|
||||||
|
|
||||||
-(void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
[super awakeFromNib];
|
[super awakeFromNib];
|
||||||
|
|
||||||
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
|
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||||
|
|
||||||
self.backgroundColor = [UIColor whiteColor];
|
self.backgroundColor = [UIColor whiteColor];
|
||||||
// self.cellLabelHeightConstraint.constant = 0.0f;
|
// self.cellLabelHeightConstraint.constant = 0.0f;
|
||||||
|
|
||||||
self.textContainer.layer.borderColor = [[UIColor lightGrayColor] CGColor];
|
self.textContainer.layer.borderColor = [[UIColor lightGrayColor] CGColor];
|
||||||
self.textContainer.layer.borderWidth = 0.75f;
|
self.textContainer.layer.borderWidth = 0.75f;
|
||||||
|
@ -53,10 +53,10 @@
|
||||||
|
|
||||||
#pragma mark - Collection view cell
|
#pragma mark - Collection view cell
|
||||||
|
|
||||||
-(void)prepareForReuse
|
- (void)prepareForReuse
|
||||||
{
|
{
|
||||||
[super prepareForReuse];
|
[super prepareForReuse];
|
||||||
|
|
||||||
self.cellLabel.text = nil;
|
self.cellLabel.text = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue