diff options
author | Vitaly Takmazov | 2019-03-26 15:23:50 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-03-26 15:23:50 +0300 |
commit | 9129e92ec546499f23d6e807e3f514876eded012 (patch) | |
tree | 076231a400299e2100601479b960a46b70b86f58 | |
parent | a58828eea45ab1169203cd369a8c2c1f4c32efaf (diff) |
Stop using AFNetworking image loader
-rw-r--r-- | Juick/Supporting Files/Juick-Prefix.pch | 1 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.m | 7 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.m | 7 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.xib | 6 | ||||
-rw-r--r-- | Juick/Views/MessageCell.h | 2 | ||||
-rw-r--r-- | Juick/Views/MessageCell.m | 7 | ||||
-rw-r--r-- | Juick/Views/MessageCell.xib | 34 |
7 files changed, 31 insertions, 33 deletions
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 <SAMKeychain/SAMKeychain.h> #import "UIImage+Utils.h" #import <AFNetworking/AFNetworking.h> - #import <AFNetworking/UIImageView+AFNetworking.h> #import <DateTools/DateTools.h> #import <PHFComposeBarView/PHFComposeBarView.h> #import <UIView+Shimmer.h> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> @@ -24,7 +24,7 @@ <stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="256" verticalHuggingPriority="252" horizontalCompressionResistancePriority="747" verticalCompressionResistancePriority="752" axis="vertical" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="Sas-e1-iNF"> <rect key="frame" x="0.0" y="64" width="52" height="76.5"/> <subviews> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" adjustsImageSizeForAccessibilityContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WsB-eh-dhD"> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" adjustsImageSizeForAccessibilityContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WsB-eh-dhD"> <rect key="frame" x="1" y="0.0" width="50" height="50"/> <constraints> <constraint firstAttribute="width" priority="750" constant="48" id="6ox-eq-Vlp"/> 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<MessageCellDelegate> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="438" id="KGk-i7-Jjw" customClass="MessageCell"> - <rect key="frame" x="0.0" y="0.0" width="574" height="438"/> + <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="604" id="KGk-i7-Jjw" customClass="MessageCell"> + <rect key="frame" x="0.0" y="0.0" width="572" height="604"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> - <rect key="frame" x="0.0" y="0.0" width="574" height="437.5"/> + <rect key="frame" x="0.0" y="0.0" width="572" height="603.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="Azj-pa-GEC"> - <rect key="frame" x="6" y="6" width="562" height="425.5"/> + <rect key="frame" x="6" y="6" width="560" height="591.5"/> <subviews> - <stackView opaque="NO" contentMode="scaleToFill" verticalCompressionResistancePriority="751" distribution="fillProportionally" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="7FT-kJ-84d"> - <rect key="frame" x="0.0" y="0.0" width="562" height="48"/> + <stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" distribution="fillProportionally" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="7FT-kJ-84d"> + <rect key="frame" x="0.0" y="0.0" width="560" height="91.5"/> <subviews> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="CZk-Q8-JqS"> - <rect key="frame" x="0.0" y="0.0" width="48" height="48"/> + <rect key="frame" x="0.0" y="22" width="48" height="48"/> <constraints> <constraint firstAttribute="height" priority="999" constant="48" id="ZnT-UD-xga"/> <constraint firstAttribute="width" constant="48" id="khZ-DB-qfq"/> </constraints> </imageView> <stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="o3h-ci-LWF"> - <rect key="frame" x="60" y="3" width="502" height="42.5"/> + <rect key="frame" x="60" y="24.5" width="500" height="42.5"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CHd-h0-hPk"> - <rect key="frame" x="0.0" y="0.0" width="502" height="20.5"/> + <rect key="frame" x="0.0" y="0.0" width="500" height="20.5"/> <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AVu-qV-q84"> - <rect key="frame" x="0.0" y="26.5" width="502" height="16"/> + <rect key="frame" x="0.0" y="26.5" width="500" height="16"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -51,22 +51,22 @@ </stackView> </subviews> </stackView> - <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt"> - <rect key="frame" x="0.0" y="60" width="562" height="192"/> + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="749" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt"> + <rect key="frame" x="0.0" y="103.5" width="560" height="192"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <string key="text">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.</string> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> </textView> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Uha-ow-kFJ"> - <rect key="frame" x="0.0" y="264" width="562" height="149.5"/> + <rect key="frame" x="0.0" y="307.5" width="560" height="256"/> <constraints> <constraint firstAttribute="height" priority="999" constant="256" identifier="attachHeight" id="Cuq-dQ-VYU"/> <constraint firstAttribute="width" priority="999" constant="256" id="oJg-1R-jp3"/> </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aJE-mZ-MCS"> - <rect key="frame" x="0.0" y="425.5" width="562" height="0.0"/> + <rect key="frame" x="0.0" y="575.5" width="560" height="16"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -91,7 +91,7 @@ <outlet property="timestamp" destination="AVu-qV-q84" id="Cyn-0y-V0R"/> <outlet property="title" destination="CHd-h0-hPk" id="BuC-dv-0sU"/> </connections> - <point key="canvasLocation" x="161" y="266"/> + <point key="canvasLocation" x="158.40000000000001" y="340.02998500749629"/> </tableViewCell> </objects> </document> |