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/ViewControllers/DialogsViewController.m | 18 +++++++++++++++--- Juick/ViewControllers/DiscoverViewController.m | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'Juick/ViewControllers') 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]; -- cgit v1.2.3