From 2a4770c84aaf2be9c58622f108007facef670fd3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 8 Apr 2018 12:15:17 +0300 Subject: PM pushes --- Juick/AppDelegate.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Juick/AppDelegate.m') 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"]; } } -- cgit v1.2.3