1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-04 02:17:51 +01:00
Telegram/Watch/Extension/TGNeoConversationTimeRowController.m
2016-02-25 01:03:51 +01:00

53 lines
1.4 KiB
Objective-C

#import "TGNeoConversationTimeRowController.h"
#import "TGChatTimestamp.h"
#import "TGExtensionDelegate.h"
NSString *const TGNeoConversationTimeRowIdentifier = @"TGNeoConversationTimeRow";
@implementation TGNeoConversationTimeRowController
- (void)updateWithTimestamp:(TGChatTimestamp *)timestamp
{
NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:timestamp.string attributes:@{ NSFontAttributeName: [UIFont systemFontOfSize:[TGNeoConversationTimeRowController textFontSize]], NSForegroundColorAttributeName: [UIColor whiteColor] }];
self.label.attributedText = attributedText;
}
+ (CGFloat)textFontSize
{
TGContentSizeCategory category = [TGExtensionDelegate instance].contentSizeCategory;
switch (category)
{
case TGContentSizeCategoryXS:
return 10.0f;
case TGContentSizeCategoryS:
return 11.0f;
case TGContentSizeCategoryL:
return 12.0f;
case TGContentSizeCategoryXL:
return 13.0f;
case TGContentSizeCategoryXXL:
return 14.0f;
case TGContentSizeCategoryXXXL:
return 15.0f;
default:
break;
}
return 16.0f;
}
+ (NSString *)identifier
{
return TGNeoConversationTimeRowIdentifier;
}
@end