From 68befabf1b72dc03acdacc4e443b00f80495b7fe Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 1 Oct 2019 23:05:16 +0300 Subject: MessageCell styling --- Juick/Views/MessageCell.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Juick/Views/MessageCell.m') diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 551a54d..4d53273 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -57,11 +57,14 @@ completion:nil]; }]; if ([msg.attach length] > 0) { - self.attach.image = [UIImage placeholderImageWithColor:[UIColor colorNamed:@"Muted"] size:CGSizeMake([msg.attachment.medium.width floatValue], [msg.attachment.medium.height floatValue])]; - CGFloat imageHeight = [msg.attachment.medium.height floatValue] / [[UIScreen mainScreen] scale]; + CGFloat imageHeight = [msg.attachment.small.height floatValue] / [[UIScreen mainScreen] scale]; + CGFloat imageWidth = [msg.attachment.small.width floatValue] / [[UIScreen mainScreen] scale]; + self.attach.image = [UIImage placeholderImageWithColor:[UIColor colorNamed:@"Muted"] size:CGSizeMake(imageWidth, imageHeight)]; + self.attachmentHeight.constant = imageHeight; + self.attachmentWidth.constant = imageWidth; __weak UIImageView *weakAttach = self.attach; - [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:msg.attachment.medium.url] callback:^(NSData *data) { + [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:msg.attachment.small.url] callback:^(NSData *data) { [UIView transitionWithView:weakAttach duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve @@ -89,6 +92,7 @@ } self.text.attributedText = nil; if (msg.text) { + [self.text setHidden:NO]; NSMutableAttributedString *txt = [[NSMutableAttributedString alloc] initWithString:msg.text attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]}]; @@ -133,6 +137,8 @@ } [txt endEditing]; self.text.attributedText = txt; + } else { + [self.text setHidden:YES]; } } -- cgit v1.2.3