From 9129e92ec546499f23d6e807e3f514876eded012 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 26 Mar 2019 15:23:50 +0300 Subject: Stop using AFNetworking image loader --- Juick/Supporting Files/Juick-Prefix.pch | 1 - Juick/Views/BubbleMessageCell.m | 7 ++++--- Juick/Views/ConversationCell.m | 7 ++++--- Juick/Views/ConversationCell.xib | 6 +++--- Juick/Views/MessageCell.h | 2 -- Juick/Views/MessageCell.m | 7 +++---- Juick/Views/MessageCell.xib | 34 ++++++++++++++++----------------- 7 files changed, 31 insertions(+), 33 deletions(-) (limited to 'Juick') diff --git a/Juick/Supporting Files/Juick-Prefix.pch b/Juick/Supporting Files/Juick-Prefix.pch index 48932ba..c9a0d25 100644 --- a/Juick/Supporting Files/Juick-Prefix.pch +++ b/Juick/Supporting Files/Juick-Prefix.pch @@ -20,7 +20,6 @@ #import #import "UIImage+Utils.h" #import - #import #import #import #import diff --git a/Juick/Views/BubbleMessageCell.m b/Juick/Views/BubbleMessageCell.m index ce41002..f889200 100644 --- a/Juick/Views/BubbleMessageCell.m +++ b/Juick/Views/BubbleMessageCell.m @@ -7,6 +7,7 @@ // #import "BubbleMessageCell.h" +#import "APIClient.h" @implementation BubbleMessageCell @@ -30,15 +31,15 @@ self.message.text = message.text; self.unreadMarker.text = @""; __weak UIImageView *weakAvatar = self.avatarView; - [self.avatarView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:message.user.avatar]] placeholderImage:nil success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:message.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]; + }]; } @end diff --git a/Juick/Views/ConversationCell.m b/Juick/Views/ConversationCell.m index e4a000c..dd17963 100644 --- a/Juick/Views/ConversationCell.m +++ b/Juick/Views/ConversationCell.m @@ -7,6 +7,7 @@ // #import "ConversationCell.h" +#import "APIClient.h" @implementation ConversationCell @@ -16,15 +17,15 @@ self.lastMessage.text = chat.lastMessageText; self.unreadMarker.hidden = true; __weak UIImageView *weakAvatar = self.avatar; - [self.avatar setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:chat.avatar]] placeholderImage:nil success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:chat.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]; + }]; } @end diff --git a/Juick/Views/ConversationCell.xib b/Juick/Views/ConversationCell.xib index 4d611d0..7ee1cfe 100644 --- a/Juick/Views/ConversationCell.xib +++ b/Juick/Views/ConversationCell.xib @@ -1,11 +1,11 @@ - + - + @@ -24,7 +24,7 @@ - + diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index 931146a..7648c52 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -23,8 +23,6 @@ @property (weak, nonatomic) IBOutlet NSLayoutConstraint *attachmentHeight; @property (weak, nonatomic) IBOutlet UILabel *summary; -@property (nonatomic, weak) Message *message; - @property (nonatomic, strong) id delegate; - (void) configureWithMessage:(Message *)msg; 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; diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index 7415b41..f4ae806 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -1,48 +1,48 @@ - + - + - - + + - + - + - - + + - + - + - - + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - + -- cgit v1.2.3