diff options
-rw-r--r-- | Juick/Main.storyboard | 4 | ||||
-rw-r--r-- | Juick/ViewControllers/ChatViewController.m | 2 | ||||
-rw-r--r-- | Juick/ViewControllers/JuickNavigationController.m | 26 | ||||
-rw-r--r-- | Juick/ViewControllers/ThreadViewController.m | 8 |
4 files changed, 22 insertions, 18 deletions
diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index 4ab443e..20364fe 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -8,10 +8,10 @@ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> - <!--Thread View Controller--> + <!--Thread--> <scene sceneID="hRe-9n-wGd"> <objects> - <tableViewController storyboardIdentifier="threadViewControllerIdentifier" hidesBottomBarWhenPushed="YES" id="egN-ti-sbh" customClass="ThreadViewController" sceneMemberID="viewController"> + <tableViewController storyboardIdentifier="threadViewControllerIdentifier" title="Thread" hidesBottomBarWhenPushed="YES" id="egN-ti-sbh" customClass="ThreadViewController" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="R7I-ps-E4b"> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 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]) { |