summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/DiscoverViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-05 02:03:05 +0300
committerGravatar Vitaly Takmazov2017-12-05 02:03:05 +0300
commit659c8741b35b9ed59c46de9af06064d7a645c602 (patch)
tree476fc2722ea82b927ef3fc1e69d854618bfdfc1c /Juick/ViewControllers/DiscoverViewController.m
parenta228ce07cc5413a6ba164c12042ab1e4028aa5b3 (diff)
deep link
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]];
}
}