diff options
Diffstat (limited to 'Juick/AppDelegate.m')
-rw-r--r-- | Juick/AppDelegate.m | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index e2eebe5..7cfd052 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -86,15 +86,22 @@ NSLog(@"User Info : %@", userInfo); [self parseNotificationPayload:userInfo]; UITabBarController *main = (UITabBarController *)self.window.rootViewController; - [main setSelectedIndex:0]; - UINavigationController *discover = (UINavigationController *)[main.viewControllers objectAtIndex:0]; - [[discover.viewControllers objectAtIndex:0] performSegueWithIdentifier:@"threadViewSegue" sender:discover]; + if (self.pushedThread > 0) { + [main setSelectedIndex:0]; + UINavigationController *discover = (UINavigationController *)[main.viewControllers objectAtIndex:0]; + [[discover.viewControllers objectAtIndex:0] performSegueWithIdentifier:@"threadViewSegue" sender:discover]; + } else { + [main setSelectedIndex:1]; + UINavigationController *dialogs = (UINavigationController *)[main.viewControllers objectAtIndex:1]; + [[dialogs.viewControllers objectAtIndex:0] performSegueWithIdentifier:@"chatSegue" sender:dialogs]; + } completionHandler(); } -(void) parseNotificationPayload:(NSDictionary *)userInfo { if (userInfo != nil) { self.pushedThread = [userInfo objectForKey:@"mid"]; + self.pushedUname = [userInfo objectForKey:@"uname"]; } } |