diff options
Diffstat (limited to 'Juick/MessagesViewController.m')
-rw-r--r-- | Juick/MessagesViewController.m | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m index 372345a..7369bd9 100644 --- a/Juick/MessagesViewController.m +++ b/Juick/MessagesViewController.m @@ -61,6 +61,9 @@ static NSString *CellIdentifier = @"MessageCell"; } - (void)scrollViewDidScroll:(UIScrollView *)scrollView { + if (self.url.absoluteString == [Message threadUrl]) { + return; + } CGPoint pos = scrollView.contentOffset; CGFloat contentHeight = scrollView.contentSize.height - scrollView.contentSize.height / 3; if (pos.y >= contentHeight && !self.dataLoading) { @@ -88,16 +91,6 @@ static NSString *CellIdentifier = @"MessageCell"; [super viewDidLoad]; self.dataLoading = NO; [self.view setBackgroundColor:[ColorsAndButtons mainBackground]]; - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - SWRevealViewController *revealController = [self revealViewController]; - [self.navigationController.navigationBar addGestureRecognizer:revealController.panGestureRecognizer]; - UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"] - style:UIBarButtonItemStyleBordered target:revealController action:@selector(revealToggle:)]; - self.navigationItem.leftBarButtonItem = revealButtonItem; - UIBarButtonItem *compose = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose - target:self action:@selector(composePressed)]; - self.navigationItem.rightBarButtonItem = compose; - } self.messages = [NSMutableArray array]; UIRefreshControl *refresh = [[UIRefreshControl alloc] init]; [refresh addTarget:self action:@selector(refreshData:) forControlEvents:UIControlEventValueChanged]; @@ -106,12 +99,16 @@ static NSString *CellIdentifier = @"MessageCell"; //UINib *cellNib = [UINib nibWithNibName:@"MessageCell" bundle:nil]; //[self.tableView registerNib:cellNib forCellReuseIdentifier:@"MessageCell"]; [self.tableView registerClass:[MessageCell class] forCellReuseIdentifier:CellIdentifier]; - [self loadFromURL:[NSURL URLWithString:@"https://api.juick.com/messages"] withTitle:@"Discover"]; - } - (void) composePressed { - [self.navigationController pushViewController:[[NewPostViewController alloc] init] animated:YES]; + CATransition* transition = [CATransition animation]; + transition.duration = 0.3; + transition.type = kCATransitionFade; + transition.subtype = kCATransitionFromTop; + + [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; + [self.navigationController pushViewController:[[NewPostViewController alloc] init] animated:NO]; } - (void)viewDidAppear:(BOOL)animated @@ -165,8 +162,6 @@ static NSString *CellIdentifier = @"MessageCell"; - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - - MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; [cell updateFonts]; @@ -192,6 +187,15 @@ static NSString *CellIdentifier = @"MessageCell"; return 100.0f; } +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if ([self.url.absoluteString hasPrefix:[Message threadUrl]]) + return; + Message *msg = [_messages objectAtIndex:indexPath.row]; + MessagesViewController *threadViewController = [[MessagesViewController alloc] init]; + [threadViewController loadFromURL:[[NSURL URLWithString:[Message threadUrl]] URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:msg.MID, @"mid", nil]] withTitle:[NSString stringWithFormat:@"#%@", msg.MID]]; + [self.navigationController pushViewController:threadViewController animated:NO]; +} + -(void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem { self.navigationItem.leftBarButtonItem = nil; } |