summaryrefslogtreecommitdiff
path: root/Juick/Views/MessageCell.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-01 23:05:16 +0300
committerGravatar Vitaly Takmazov2019-10-01 23:05:16 +0300
commit68befabf1b72dc03acdacc4e443b00f80495b7fe (patch)
tree76781daa9b853854d1d180a75608bf1fc77ba4f5 /Juick/Views/MessageCell.m
parentfbbe573afe150a23205264d0d46b4e00d7330b8a (diff)
MessageCell styling
Diffstat (limited to 'Juick/Views/MessageCell.m')
-rw-r--r--Juick/Views/MessageCell.m12
1 files changed, 9 insertions, 3 deletions
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];
}
}