diff options
author | Vitaly Takmazov | 2018-10-18 19:06:12 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-10-18 19:06:12 +0300 |
commit | ab1406ff4f2a0414483f24114f4fa9d1bc932e0d (patch) | |
tree | 3aac81c326b933f13b0680d84077e65b0f147e17 | |
parent | 675d2bd7c52ef0e191d52784f20f3c35e4b308f6 (diff) |
load last message text in pms, fix layout
-rw-r--r-- | Juick/Model/Chat.h | 2 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.m | 2 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.xib | 36 |
3 files changed, 24 insertions, 16 deletions
diff --git a/Juick/Model/Chat.h b/Juick/Model/Chat.h index 42647b0..a472389 100644 --- a/Juick/Model/Chat.h +++ b/Juick/Model/Chat.h @@ -14,4 +14,6 @@ @property NSNumber *uid; @property NSString *uname; @property NSNumber *unreadCount; +@property NSDate *lastMessageTimestamp; +@property NSString *lastMessageText; @end diff --git a/Juick/Views/ConversationCell.m b/Juick/Views/ConversationCell.m index ca09cd0..ff5ec2f 100644 --- a/Juick/Views/ConversationCell.m +++ b/Juick/Views/ConversationCell.m @@ -19,6 +19,8 @@ -(void) configureWithChat:(Chat *)chat { self.chatName.textColor = [ColorScheme linkColor]; self.chatName.text = chat.uname; + self.lastMessage.text = chat.lastMessageText; + self.unreadMarker.hidden = chat.unreadCount > 0; __weak UIImageView *weakAvatar = self.avatar; [self.avatar setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [chat.uid intValue]]]] placeholderImage:nil success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { [UIView transitionWithView:weakAvatar diff --git a/Juick/Views/ConversationCell.xib b/Juick/Views/ConversationCell.xib index 09b5a7e..4d611d0 100644 --- a/Juick/Views/ConversationCell.xib +++ b/Juick/Views/ConversationCell.xib @@ -11,45 +11,49 @@ <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" rowHeight="127" id="eKX-ht-IFf" customClass="ConversationCell"> - <rect key="frame" x="0.0" y="0.0" width="478" height="127"/> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" rowHeight="238" id="eKX-ht-IFf" customClass="ConversationCell"> + <rect key="frame" x="0.0" y="0.0" width="324" height="238"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eKX-ht-IFf" id="3NU-ng-4QM"> - <rect key="frame" x="0.0" y="0.0" width="478" height="126.5"/> + <rect key="frame" x="0.0" y="0.0" width="324" height="237.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="6O8-u9-Jvc"> - <rect key="frame" x="6" y="17" width="466" height="93"/> + <rect key="frame" x="6" y="17" width="312" height="204"/> <subviews> - <stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" verticalHuggingPriority="252" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="752" axis="vertical" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="Sas-e1-iNF"> - <rect key="frame" x="0.0" y="9.5" width="49.5" height="74.5"/> + <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"> - <rect key="frame" x="1" y="0.0" width="48" height="48"/> + <rect key="frame" x="1" y="0.0" width="50" height="50"/> <constraints> - <constraint firstAttribute="width" constant="48" id="6ox-eq-Vlp"/> - <constraint firstAttribute="height" constant="48" id="e88-rG-unU"/> + <constraint firstAttribute="width" priority="750" constant="48" id="6ox-eq-Vlp"/> + <constraint firstAttribute="height" priority="750" constant="48" id="e88-rG-unU"/> </constraints> </imageView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="●" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jW2-kr-sJn"> - <rect key="frame" x="17.5" y="54" width="15" height="20.5"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="●" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jW2-kr-sJn"> + <rect key="frame" x="18.5" y="56" width="15" height="20.5"/> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <color key="textColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <nil key="highlightedColor"/> </label> </subviews> + <constraints> + <constraint firstAttribute="width" constant="52" id="333-j0-nGK"/> + <constraint firstAttribute="height" priority="750" constant="68" id="D1h-DA-sXz"/> + </constraints> </stackView> - <stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" horizontalCompressionResistancePriority="751" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="dJe-jR-n42"> - <rect key="frame" x="61.5" y="11.5" width="404.5" height="70.5"/> + <stackView opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="dJe-jR-n42"> + <rect key="frame" x="64" y="70" width="248" height="64.5"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TTg-gl-dzG"> - <rect key="frame" x="0.0" y="0.0" width="404.5" height="20.5"/> + <rect key="frame" x="0.0" y="0.0" width="248" height="20.5"/> <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EiA-lG-gV5"> - <rect key="frame" x="0.0" y="32.5" width="404.5" height="38"/> + <rect key="frame" x="0.0" y="26.5" width="248" height="38"/> <string key="text">Lorem sdsdasds sdsada ddas dsad asdsadas dasd asdsa sadsa dasdsad asd asdas dasd asdas dasd asdas dasdasdasd asdasdasdadasdasd asdasd asdas dasdsa dasdasdasdasdas dasdas</string> <fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/> <color key="textColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> @@ -73,7 +77,7 @@ <outlet property="lastMessage" destination="EiA-lG-gV5" id="Eq9-zQ-ivW"/> <outlet property="unreadMarker" destination="jW2-kr-sJn" id="E5Q-wn-yln"/> </connections> - <point key="canvasLocation" x="-1846" y="27"/> + <point key="canvasLocation" x="-1768" y="8.995502248875562"/> </tableViewCell> </objects> </document> |