From ab1406ff4f2a0414483f24114f4fa9d1bc932e0d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 18 Oct 2018 19:06:12 +0300 Subject: load last message text in pms, fix layout --- Juick/Model/Chat.h | 2 ++ Juick/Views/ConversationCell.m | 2 ++ 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 @@ - - + + - + - + - - + + - + - - + + - + + + + - - + + -- cgit v1.2.3