diff options
Diffstat (limited to 'Juick/Views/MessageCell.m')
-rw-r--r-- | Juick/Views/MessageCell.m | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 26d74a4..551a54d 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -45,7 +45,6 @@ } - (void) configureWithMessage:(Message *)msg { - self.message = msg; self.avatar.image = nil; __weak UIImageView *weakAvatar = self.avatar; [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:msg.user.avatar] callback:^(NSData *data) { @@ -62,15 +61,15 @@ CGFloat imageHeight = [msg.attachment.medium.height floatValue] / [[UIScreen mainScreen] scale]; self.attachmentHeight.constant = imageHeight; __weak UIImageView *weakAttach = self.attach; - [self.attach setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:msg.attachment.medium.url]] placeholderImage:nil success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:msg.attachment.medium.url] callback:^(NSData *data) { [UIView transitionWithView:weakAttach duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ - weakAttach.image = image; + weakAttach.image = [UIImage imageWithData:data]; } completion:nil]; - } failure:nil]; + }]; } else { self.attachmentHeight.constant = 0; self.attach.image = nil; |