summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/MessagesViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-03-21 20:17:42 +0300
committerGravatar Vitaly Takmazov2019-03-21 20:17:42 +0300
commit6b40f06a691e1264f6e35b6a5616198e6977787d (patch)
treed7aa6427861523a8447d52a8b45d57a605a1a714 /Juick/ViewControllers/MessagesViewController.m
parente6fec9707f61b5d521bf1a2e6a85998f2466bdfa (diff)
Named colours
Diffstat (limited to 'Juick/ViewControllers/MessagesViewController.m')
-rw-r--r--Juick/ViewControllers/MessagesViewController.m40
1 files changed, 38 insertions, 2 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index 9cece2c..8b4bfae 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -9,9 +9,9 @@
#import "MessagesViewController.h"
#import "MessageCell.h"
+#import "AppDelegate.h"
#import "APIClient.h"
#import "Message.h"
-#import "ColorScheme.h"
#import "NewPostViewController.h"
#import "LoginViewController.h"
@@ -85,7 +85,7 @@
{
[super viewDidLoad];
self.dataLoading = YES;
- [self.view setBackgroundColor:[ColorScheme mainBackground]];
+ [self.view setBackgroundColor:[UIColor colorNamed:@"Background"]];
[self.tableView registerNib:[UINib nibWithNibName:@"MessageCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"messageCell"];
[self.tableView registerNib:[UINib nibWithNibName:@"ContentLoadingCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"contentLoadingCell"];
self.tableView.rowHeight = UITableViewAutomaticDimension;
@@ -126,6 +126,42 @@
return self.dataLoading && self.messages.count == 0 ? 200.0f : [super tableView:tableView heightForRowAtIndexPath:indexPath];
}
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ NSString * cellIdentifier = @"messageCell";
+ MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
+ [self performSegueWithIdentifier:@"threadViewSegue" sender:cell];
+}
+
+-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+ if ([segue.identifier isEqual: @"threadViewSegue"]) {
+ NSNumber *mid;
+ BOOL scrollToEnd = NO;
+ if ([AppDelegate shared].pushedThread != nil) {
+ mid = [[AppDelegate shared].pushedThread copy];
+ [AppDelegate shared].pushedThread = nil;
+ [AppDelegate shared].pushedUname = nil;
+ scrollToEnd = YES;
+ } else {
+ Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
+ mid = msg.mid;
+ }
+ if ([mid integerValue] > 0) {
+ ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController;
+ [threadVC setPath:[APIClient threadUrl]];
+ [threadVC setParams:@{@"mid": mid }];
+ [threadVC setShouldScrollToBottomOnRefresh:scrollToEnd];
+ }
+ }
+ /*
+ if ([segue.identifier isEqual: @"profileSegue"]) {
+ BlogViewController *blogVC = (BlogViewController *)segue.destinationViewController;
+ [blogVC setUname:self.selectedUser];
+ [blogVC setTitle:self.selectedUser];
+ blogVC.path = [NSString stringWithFormat:@"/messages?uname=%@", self.selectedUser];
+ [blogVC setShouldScrollToBottomOnRefresh:NO];
+ }*/
+}
+
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView_ {
CGFloat actualPosition = scrollView_.contentOffset.y;
CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2;