From 1871f3d5298efb978be825b03fd9c20ff4c204a8 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 21 Mar 2019 01:23:22 +0300 Subject: APIClient fetchImageWithURL --- Juick/Views/MessageCell.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Juick/Views') diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index fb6e831..55e6054 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -32,15 +32,15 @@ self.message = msg; self.avatar.image = nil; __weak UIImageView *weakAvatar = self.avatar; - [self.avatar setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:msg.user.avatar]] placeholderImage:nil success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:msg.user.avatar] callback:^(NSData *data) { [UIView transitionWithView:weakAvatar duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ - weakAvatar.image = image; + weakAvatar.image = [UIImage imageWithData:data]; } completion:nil]; - } failure:nil]; + }]; if ([msg.attach length] > 0) { CGFloat imageHeight = [msg.attachment.small.height floatValue] / [[UIScreen mainScreen] scale]; self.attachmentHeight.constant = imageHeight; -- cgit v1.2.3