Compare commits
6 Commits
master
...
format_cal
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5218c5fa05 | ||
|
|
8341455a77 | ||
|
|
6a83e93f7f | ||
|
|
459f07aa55 | ||
|
|
f6ce71a1e0 | ||
|
|
a5c8b56e63 |
@ -470,11 +470,26 @@ static void * kJSQMessagesKeyValueObservingContext = &kJSQMessagesKeyValueObserv
|
||||
JSQCall * call = (JSQCall*)messageItem;
|
||||
cellIdentifier = self.callCellIndentifier;
|
||||
JSQCallCollectionViewCell * callCell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
|
||||
callCell.cellLabel.text = [call text];
|
||||
if (call.status == kCallMissed)
|
||||
{
|
||||
callCell.cellLabel.textColor = [UIColor redColor];
|
||||
}
|
||||
|
||||
NSString *text = [call text];
|
||||
NSString *dateText = [call dateText];
|
||||
NSString *allText = [text stringByAppendingString:dateText];
|
||||
const CGFloat fontSize = 14;
|
||||
UIFont *boldFont = [UIFont boldSystemFontOfSize:fontSize];
|
||||
UIFont *regularFont = [UIFont systemFontOfSize:fontSize];
|
||||
UIColor *foregroundColor = [UIColor whiteColor];
|
||||
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
boldFont, NSFontAttributeName, nil];
|
||||
NSDictionary *subAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
regularFont, NSFontAttributeName, nil];
|
||||
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.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)
|
||||
|
||||
@ -54,6 +54,7 @@ typedef enum : NSUInteger {
|
||||
status:(CallStatus)status;
|
||||
|
||||
-(NSString*)text;
|
||||
-(NSString*)dateText;
|
||||
|
||||
-(UIImage*)thumbnailImage;
|
||||
|
||||
|
||||
@ -50,35 +50,33 @@
|
||||
|
||||
-(NSString*)text
|
||||
{
|
||||
NSString *name = _senderDisplayName;
|
||||
|
||||
switch (self.status) {
|
||||
case kCallMissed:
|
||||
return [NSString stringWithFormat:@"You missed a call from %@.", _senderDisplayName];
|
||||
return [NSString stringWithFormat:@"Missed call from %@. ", name];
|
||||
case kCallIncoming:
|
||||
return [NSString stringWithFormat:@"You received a call from %@.", _senderDisplayName];
|
||||
return [NSString stringWithFormat:@"You received a call from %@. ", name];
|
||||
case kCallOutgoing:
|
||||
return [NSString stringWithFormat:@"You called %@.", _senderDisplayName];
|
||||
return [NSString stringWithFormat:@"You called %@. ", name];
|
||||
default:
|
||||
return nil;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
-(NSString*)dateText
|
||||
{
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
dateFormatter.timeStyle = NSDateFormatterShortStyle;
|
||||
dateFormatter.dateStyle = NSDateFormatterMediumStyle;
|
||||
dateFormatter.doesRelativeDateFormatting = YES;
|
||||
return [dateFormatter stringFromDate:_date];
|
||||
}
|
||||
|
||||
-(UIImage*)thumbnailImage
|
||||
{
|
||||
switch (self.status) {
|
||||
case kCallMissed:
|
||||
return [UIImage imageNamed:@"call_missed"];
|
||||
break;
|
||||
case kCallIncoming:
|
||||
return [[UIImage imageNamed:@"call_incoming"] jsq_imageMaskedWithColor:[UIColor darkGrayColor]];
|
||||
break;
|
||||
case kCallOutgoing:
|
||||
return [[UIImage imageNamed:@"call_outgoing"] jsq_imageMaskedWithColor:[UIColor darkGrayColor]];
|
||||
break;
|
||||
default:
|
||||
return nil;
|
||||
break;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - NSObject
|
||||
|
||||
Loading…
Reference in New Issue
Block a user