diff options
author | Vitaly Takmazov | 2018-04-08 12:15:17 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-08 12:15:17 +0300 |
commit | 2a4770c84aaf2be9c58622f108007facef670fd3 (patch) | |
tree | c8178619c2484618a5aec100394fc47e82075757 /Juick | |
parent | 80239775563a1b29136ee64c29c2379a95e504c2 (diff) |
PM pushes
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/AppDelegate.h | 1 | ||||
-rw-r--r-- | Juick/AppDelegate.m | 13 | ||||
-rw-r--r-- | Juick/Main.storyboard | 2 | ||||
-rw-r--r-- | Juick/Supporting Files/Juick-Info.plist | 2 | ||||
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 18 | ||||
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.m | 1 |
6 files changed, 29 insertions, 8 deletions
diff --git a/Juick/AppDelegate.h b/Juick/AppDelegate.h index 4454022..a493664 100644 --- a/Juick/AppDelegate.h +++ b/Juick/AppDelegate.h @@ -15,5 +15,6 @@ -(void) registerForRemoteNotifications; @property (strong, nonatomic) NSNumber *pushedThread; +@property (strong, nonatomic) NSString *pushedUname; @end 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"]; } } diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index e416be2..ad76e28 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -332,7 +332,7 @@ <!--Chat View Controller--> <scene sceneID="pvH-EU-EhQ"> <objects> - <tableViewController hidesBottomBarWhenPushed="YES" id="jVt-4s-14k" customClass="ChatViewController" sceneMemberID="viewController"> + <tableViewController storyboardIdentifier="chatViewController" hidesBottomBarWhenPushed="YES" id="jVt-4s-14k" customClass="ChatViewController" 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="CGw-ia-Afb"> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index ec5a48c..40e9d10 100644 --- a/Juick/Supporting Files/Juick-Info.plist +++ b/Juick/Supporting Files/Juick-Info.plist @@ -21,7 +21,7 @@ <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>56</string> + <string>57</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>LSApplicationCategoryType</key> diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index d40dd95..5369a65 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -11,13 +11,16 @@ #import "ColorScheme.h" #import "ConversationCell.h" #import "APIClient.h" +#import "AppDelegate.h" @interface DialogsViewController () + +@property(nonatomic, strong) AppDelegate *appDelegate; + @end @implementation DialogsViewController - - (void)viewDidLoad { [super viewDidLoad]; [self.tabBarItem setTitle:@"Chats"]; @@ -37,6 +40,7 @@ [self.tableView endUpdates]; } }]; + self.appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate; } #pragma mark - Table view data source @@ -61,9 +65,17 @@ -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"chatSegue"]) { - Chat *chat = [self.chats objectAtIndex:[self.tableView indexPathForSelectedRow].row]; + NSString *uname; + if ([self.appDelegate.pushedUname length] > 0) { + uname = [self.appDelegate.pushedUname copy]; + self.appDelegate.pushedThread = nil; + self.appDelegate.pushedUname = nil; + } else { + Chat *chat = [self.chats objectAtIndex:[self.tableView indexPathForSelectedRow].row]; + uname = chat.uname; + } ChatViewController *vc = (ChatViewController *)segue.destinationViewController; - [vc setUname:chat.uname]; + [vc setUname:uname]; } } diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m index 483c5e2..afbf32e 100644 --- a/Juick/ViewControllers/DiscoverViewController.m +++ b/Juick/ViewControllers/DiscoverViewController.m @@ -61,6 +61,7 @@ AppDelegate *appDelegate; if (appDelegate.pushedThread != nil) { mid = [appDelegate.pushedThread copy]; appDelegate.pushedThread = nil; + appDelegate.pushedUname = nil; scrollToEnd = YES; } else { Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; |