summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-21 18:30:00 +0300
committerGravatar Vitaly Takmazov2018-10-21 18:30:00 +0300
commitd958a11cc1618e080b9aab9a0b84c942afd7012a (patch)
treed4b7b6985fba50d2f6005dddeaec00ea5c385aa2 /Juick/ViewControllers
parentc3bd91b2f6b02107322603487094f26259a16703 (diff)
Chat styling
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r--Juick/ViewControllers/ChatViewController.h2
-rw-r--r--Juick/ViewControllers/ChatViewController.m10
2 files changed, 9 insertions, 3 deletions
diff --git a/Juick/ViewControllers/ChatViewController.h b/Juick/ViewControllers/ChatViewController.h
index a5c5d5a..4a5133a 100644
--- a/Juick/ViewControllers/ChatViewController.h
+++ b/Juick/ViewControllers/ChatViewController.h
@@ -12,4 +12,6 @@
@interface ChatViewController : UITableViewController<PHFComposeBarViewDelegate>
@property(nonatomic, strong) NSMutableArray *messages;
@property(nonatomic, strong) NSString *uname;
+
+-(void) reloadChat;
@end
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;
}