Added .gitignore

This commit is contained in:
Peter Iakovlev
2018-11-14 23:03:33 +04:00
commit 77ee5c4dab
869 changed files with 54858 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
#import "TGNeoTextMessageViewModel.h"
#import "TGNeoLabelViewModel.h"
#import "TGMessageViewModel.h"
#import "TGBridgeMessage.h"
@interface TGNeoTextMessageViewModel ()
{
TGNeoLabelViewModel *_textModel;
}
@end
@implementation TGNeoTextMessageViewModel
- (instancetype)initWithMessage:(TGBridgeMessage *)message type:(TGNeoMessageType)type users:(NSDictionary *)users context:(TGBridgeContext *)context
{
self = [super initWithMessage:message type:type users:users context:context];
if (self != nil)
{
NSString *text = [message.text stringByReplacingOccurrencesOfString:@"/" withString:@"/\u2060"];
CGFloat fontSize = [TGNeoBubbleMessageViewModel bodyTextFontSize];
UIColor *textColor = [self normalColorForMessage:message type:type];
if (message.textCheckingResults.count > 0)
{
_textModel = [[TGNeoLabelViewModel alloc] initWithAttributedText:[TGMessageViewModel attributedTextForMessage:message fontSize:fontSize textColor:textColor]];
}
else
{
_textModel = [[TGNeoLabelViewModel alloc] initWithText:text font:[UIFont systemFontOfSize:fontSize] color:textColor attributes:nil];
}
_textModel.multiline = true;
[self addSubmodel:_textModel];
}
return self;
}
- (CGSize)layoutWithContainerSize:(CGSize)containerSize
{
CGSize contentContainerSize = [self contentContainerSizeWithContainerSize:containerSize];
CGSize headerSize = [self layoutHeaderModelsWithContainerSize:contentContainerSize];
CGFloat maxContentWidth = headerSize.width;
CGFloat textTopOffset = headerSize.height;
CGSize textSize = [_textModel contentSizeWithContainerSize:contentContainerSize];
_textModel.frame = CGRectMake(TGNeoBubbleMessageViewModelInsets.left, textTopOffset, textSize.width, textSize.height);
if (textSize.width > maxContentWidth)
maxContentWidth = textSize.width;
CGSize contentSize = CGSizeZero;
contentSize.width = maxContentWidth + TGNeoBubbleMessageViewModelInsets.left + TGNeoBubbleMessageViewModelInsets.right;
contentSize.height = CGRectGetMaxY(_textModel.frame) + TGNeoBubbleMessageViewModelInsets.bottom;
[super layoutWithContainerSize:contentSize];
return contentSize;
}
@end