summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/DiscoverViewController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/ViewControllers/DiscoverViewController.m')
-rw-r--r--Juick/ViewControllers/DiscoverViewController.m20
1 files changed, 18 insertions, 2 deletions
diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m
index 4b22979..3c473d5 100644
--- a/Juick/ViewControllers/DiscoverViewController.m
+++ b/Juick/ViewControllers/DiscoverViewController.m
@@ -10,6 +10,7 @@
#import "ThreadViewController.h"
#import "MessageCell.h"
#import "APIClient.h"
+#import "AppDelegate.h"
@interface DiscoverViewController ()
@@ -17,6 +18,15 @@
@implementation DiscoverViewController
+AppDelegate *appDelegate;
+
+-(void) awakeFromNib {
+ [super awakeFromNib];
+ appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+ if (appDelegate.pushedThread != nil) {
+ [self performSegueWithIdentifier:@"threadViewSegue" sender:self];
+ }
+}
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -27,10 +37,16 @@
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqual: @"threadViewSegue"]) {
- Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
+ NSNumber *mid;
+ if (appDelegate.pushedThread != nil) {
+ mid = appDelegate.pushedThread;
+ } else {
+ Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
+ mid = msg.mid;
+ }
ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController;
[threadVC setPath:[APIClient threadUrl]];
- [threadVC setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]];
+ [threadVC setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:mid, @"mid", nil]];
}
}