Compare commits
6 Commits
master
...
format_cal
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5218c5fa05 | ||
|
|
8341455a77 | ||
|
|
6a83e93f7f | ||
|
|
459f07aa55 | ||
|
|
f6ce71a1e0 | ||
|
|
a5c8b56e63 |
@ -471,42 +471,33 @@ static void * kJSQMessagesKeyValueObservingContext = &kJSQMessagesKeyValueObserv
|
||||
cellIdentifier = self.callCellIndentifier;
|
||||
JSQCallCollectionViewCell * callCell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
|
||||
|
||||
NSString *text = call.date != nil ? [call text] : call.senderDisplayName;
|
||||
NSString *allText = call.date != nil ? [text stringByAppendingString:[call dateText]] : text;
|
||||
NSString *text = [call text];
|
||||
NSString *dateText = [call dateText];
|
||||
NSString *allText = [text stringByAppendingString:dateText];
|
||||
const CGFloat fontSize = 14;
|
||||
UIFont *boldFont = [UIFont fontWithName:@"HelveticaNeue-Medium" size:12.0f];
|
||||
UIFont *regularFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f];
|
||||
UIFont *boldFont = [UIFont boldSystemFontOfSize:fontSize];
|
||||
UIFont *regularFont = [UIFont systemFontOfSize:fontSize];
|
||||
UIColor *foregroundColor = [UIColor whiteColor];
|
||||
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
boldFont, NSFontAttributeName, nil];
|
||||
|
||||
NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:allText
|
||||
attributes:attrs];
|
||||
if([call date]!=nil) {
|
||||
// Not a group meta message
|
||||
NSDictionary *subAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
NSDictionary *subAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
regularFont, NSFontAttributeName, nil];
|
||||
const NSRange range = NSMakeRange([text length],[[call dateText] length]);
|
||||
|
||||
[attributedText setAttributes:subAttrs range:range];
|
||||
BOOL isOutgoing = [self.senderId isEqualToString:call.senderId];
|
||||
if (isOutgoing)
|
||||
{
|
||||
callCell.outgoingCallImageView.image = [call thumbnailImage];
|
||||
} else {
|
||||
callCell.incomingCallImageView.image = [call thumbnailImage];
|
||||
}
|
||||
}
|
||||
else {
|
||||
// A group meta message
|
||||
callCell.incomingCallImageView.image = [call thumbnailImage];
|
||||
}
|
||||
const NSRange range = NSMakeRange([text length],[dateText length]);
|
||||
NSMutableAttributedString *attributedText =
|
||||
[[NSMutableAttributedString alloc] initWithString:allText
|
||||
attributes:attrs];
|
||||
[attributedText setAttributes:subAttrs range:range];
|
||||
|
||||
callCell.cellLabel.attributedText = attributedText;
|
||||
callCell.cellLabel.lineBreakMode = UILineBreakModeWordWrap;
|
||||
callCell.cellLabel.numberOfLines = 0; // uses as many lines as it needs
|
||||
callCell.cellLabel.textColor = [UIColor colorWithRed:32.f/255.f green:144.f/255.f blue:234.f/255.f alpha:1.f];
|
||||
|
||||
BOOL isOutgoing = [self.senderId isEqualToString:call.senderId];
|
||||
if (isOutgoing)
|
||||
{
|
||||
callCell.outgoingCallImageView.image = [call thumbnailImage];
|
||||
} else {
|
||||
callCell.incomingCallImageView.image = [call thumbnailImage];
|
||||
}
|
||||
|
||||
callCell.layer.shouldRasterize = YES;
|
||||
callCell.layer.rasterizationScale = [UIScreen mainScreen].scale;
|
||||
|
||||
@ -13,13 +13,9 @@ typedef enum : NSUInteger {
|
||||
kCallOutgoing = 1,
|
||||
kCallIncoming = 2,
|
||||
kCallMissed = 3,
|
||||
kGroupUpdateJoin = 4,
|
||||
kGroupUpdateLeft = 5,
|
||||
kGroupUpdate = 6
|
||||
} CallStatus;
|
||||
|
||||
|
||||
|
||||
@interface JSQCall : NSObject <JSQMessageData, NSCoding, NSCopying>
|
||||
|
||||
/*
|
||||
@ -49,11 +45,6 @@ typedef enum : NSUInteger {
|
||||
*/
|
||||
@property (nonatomic) TSMessageAdapterType messageType;
|
||||
|
||||
/*
|
||||
* User can configure whether a thumbnail is used in the display of this cell or not
|
||||
*/
|
||||
@property (nonatomic) BOOL useThumbnail;
|
||||
|
||||
|
||||
#pragma mark - Initialization
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
{
|
||||
NSParameterAssert(senderId != nil);
|
||||
NSParameterAssert(senderDisplayName != nil);
|
||||
NSParameterAssert(date != nil);
|
||||
|
||||
self = [super init];
|
||||
if (self) {
|
||||
@ -73,35 +74,11 @@
|
||||
return [dateFormatter stringFromDate:_date];
|
||||
}
|
||||
|
||||
-(UIImage*)thumbnailImage {
|
||||
// This relies on those assets being in the project
|
||||
if(!_useThumbnail) {
|
||||
return nil;
|
||||
}
|
||||
switch (_status) {
|
||||
case kCallOutgoing:
|
||||
return [UIImage imageNamed:@"statCallOutgoing--blue"];
|
||||
break;
|
||||
case kCallIncoming:
|
||||
case kCallMissed:
|
||||
return [UIImage imageNamed:@"statCallIncoming--blue"];
|
||||
break;
|
||||
case kGroupUpdate:
|
||||
return [UIImage imageNamed:@"statRefreshedGroup--blue"];
|
||||
break;
|
||||
case kGroupUpdateLeft:
|
||||
return [UIImage imageNamed:@"statLeftGroup--blue"];
|
||||
break;
|
||||
case kGroupUpdateJoin:
|
||||
return [UIImage imageNamed:@"statJoinedGroup--blue"];
|
||||
break;
|
||||
default:
|
||||
return nil;
|
||||
break;
|
||||
}
|
||||
-(UIImage*)thumbnailImage
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - NSObject
|
||||
|
||||
-(BOOL)isEqual:(id)object
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
#import "JSQMessagesLabel.h"
|
||||
|
||||
#define kCallCellHeight 40.0f
|
||||
#define kCallCellWidth 400.0f
|
||||
#define kCallCellHeight 20.0f
|
||||
#define kCallCellWidth 200.0f
|
||||
|
||||
@interface JSQCallCollectionViewCell : UICollectionViewCell
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user