From d958a11cc1618e080b9aab9a0b84c942afd7012a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 21 Oct 2018 18:30:00 +0300 Subject: Chat styling --- Juick/ViewControllers/ChatViewController.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Juick/ViewControllers/ChatViewController.m') diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m index 489de66..c36bf1a 100644 --- a/Juick/ViewControllers/ChatViewController.m +++ b/Juick/ViewControllers/ChatViewController.m @@ -13,6 +13,7 @@ @interface ChatViewController () @property (nonatomic, readwrite, retain) UIView *inputAccessoryView; +@property (nonatomic, strong) NSString *me; @end @@ -25,8 +26,11 @@ self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive; self.tableView.allowsSelection = NO; + self.me = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"]; [self reloadChat]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil]; + self.refreshControl = [UIRefreshControl new]; + [self.refreshControl addTarget:self action:@selector(reloadChat) forControlEvents:UIControlEventValueChanged]; } -(void) reloadChat { @@ -44,6 +48,7 @@ [self.tableView endUpdates]; [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.messages count]-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; } + [self.refreshControl endRefreshing]; }]; } @@ -59,9 +64,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { BubbleMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"bubbleMessageCell" forIndexPath:indexPath]; - - [cell configureWithMessage:[self.messages objectAtIndex:indexPath.row]]; - + Message *message = [self.messages objectAtIndex:indexPath.row]; + [cell configureWithMessage:message isMe:[self.me isEqualToString:message.user.uname]]; return cell; } -- cgit v1.2.3