diff options
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r-- | Juick/ViewControllers/ChatViewController.m | 2 | ||||
-rw-r--r-- | Juick/ViewControllers/JuickNavigationController.m | 26 | ||||
-rw-r--r-- | Juick/ViewControllers/ThreadViewController.m | 8 |
3 files changed, 20 insertions, 16 deletions
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m index 4f9481c..989b531 100644 --- a/Juick/ViewControllers/ChatViewController.m +++ b/Juick/ViewControllers/ChatViewController.m @@ -21,7 +21,7 @@ - (void)viewDidLoad { [super viewDidLoad]; - [self.navigationController.navigationItem setTitle:self.uname]; + [self.navigationController.visibleViewController setTitle:self.uname]; [self.tableView registerNib:[UINib nibWithNibName:@"BubbleMessageCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"bubbleMessageCell"]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive; diff --git a/Juick/ViewControllers/JuickNavigationController.m b/Juick/ViewControllers/JuickNavigationController.m index a066dbd..8673866 100644 --- a/Juick/ViewControllers/JuickNavigationController.m +++ b/Juick/ViewControllers/JuickNavigationController.m @@ -12,6 +12,7 @@ #import "APIClient.h" #import "MessagesViewController.h" #import "ThreadViewController.h" +#import "NewPostViewController.h" #import "Message.h" @@ -43,19 +44,30 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"threadSegue"]) { - if ([sender isKindOfClass:[MessagesViewController class]]) { + ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController; + [threadVC setShouldScrollToUnreadOnRefresh:NO]; + NSNumber *pushedThread = [AppDelegate shared].pushedThread; + if (pushedThread) { + [threadVC setParams:@{@"mid": pushedThread }]; + if ([AppDelegate shared].pushedReplyId) { + [threadVC setFirstUnread:[AppDelegate shared].pushedReplyId]; + [threadVC setShouldScrollToUnreadOnRefresh:YES]; + } + } else { MessagesViewController *vc = (MessagesViewController *) sender; Message *msg = vc.messages[vc.tableView.indexPathForSelectedRow.row]; - ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController; [threadVC setMessages:[@[msg] mutableCopy]]; [threadVC setParams:@{@"mid": msg.mid }]; [threadVC setShouldScrollToUnreadOnRefresh:NO]; } - /* - if (rid) { - [threadVC setFirstUnread:rid]; - [threadVC setShouldScrollToUnreadOnRefresh:YES]; - }*/ + } + if ([segue.identifier isEqualToString:@"editorSegue"]) { + if ([sender isKindOfClass:[ThreadViewController class]]) { + ThreadViewController *thread = (ThreadViewController *) sender; + Message *msg = [thread.messages objectAtIndex:[thread.tableView indexPathForSelectedRow].row]; + NewPostViewController *postVC = [[((UINavigationController *)segue.destinationViewController) viewControllers] firstObject]; + [postVC setReplyTo:msg]; + } } } diff --git a/Juick/ViewControllers/ThreadViewController.m b/Juick/ViewControllers/ThreadViewController.m index 646dbc4..c345822 100644 --- a/Juick/ViewControllers/ThreadViewController.m +++ b/Juick/ViewControllers/ThreadViewController.m @@ -28,14 +28,6 @@ } } --(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqual: @"editorSegue"]) { - Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; - NewPostViewController *postVC = (NewPostViewController *)segue.destinationViewController; - [postVC setReplyTo:msg]; - } -} - - (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender { if ([identifier isEqualToString:@"editorSegue"]) { if ([[APIClient sharedClient] isAuthenticated]) { |