diff options
Diffstat (limited to 'Juick/ViewControllers/JuickNavigationController.m')
-rw-r--r-- | Juick/ViewControllers/JuickNavigationController.m | 26 |
1 files changed, 19 insertions, 7 deletions
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]; + } } } |