From 29c5e93f4bd433bea7402a362fe1c812a43c3891 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 29 Mar 2019 09:42:48 +0300 Subject: cleanupPushedData --- Juick/AppDelegate.h | 2 ++ Juick/AppDelegate.m | 7 +++++++ Juick/ViewControllers/DialogsViewController.m | 3 +-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Juick/AppDelegate.h b/Juick/AppDelegate.h index 54d627e..5357af2 100644 --- a/Juick/AppDelegate.h +++ b/Juick/AppDelegate.h @@ -18,6 +18,8 @@ extern NSString * const UserUpdatedNotificationName; -(void) registerForRemoteNotifications; +-(void) cleanupPushedData; + +(AppDelegate *) shared; +(ThreadViewController *) threadViewController; diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index b483a68..9501316 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -99,6 +99,7 @@ NSString * const UserUpdatedNotificationName = @"UserUpdated"; [discover popToRootViewControllerAnimated:NO]; MessagesViewController *msgVC = (MessagesViewController *)[discover.viewControllers objectAtIndex:0]; [msgVC viewThreadForMessage:nil mid:self.pushedThread scrollTo:self.pushedReplyId]; + [self cleanupPushedData]; } else { [main setSelectedIndex:2]; UINavigationController *dialogs = (UINavigationController *)[main.viewControllers objectAtIndex:2]; @@ -138,6 +139,12 @@ NSString * const UserUpdatedNotificationName = @"UserUpdated"; self.pushedReplyId = userInfo[@"rid"]; } +-(void) cleanupPushedData { + self.pushedUname = nil; + self.pushedThread = nil; + self.pushedReplyId = nil; +} + +(AppDelegate *) shared { return (AppDelegate *)[UIApplication sharedApplication].delegate; } diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index c2296dd..1e5d3c2 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -70,8 +70,7 @@ NSString *uname; if ([[AppDelegate shared].pushedUname length] > 0) { uname = [[AppDelegate shared].pushedUname copy]; - [AppDelegate shared].pushedThread = nil; - [AppDelegate shared].pushedUname = nil; + [[AppDelegate shared] cleanupPushedData]; } else { Chat *chat = [self.chats objectAtIndex:[self.tableView indexPathForSelectedRow].row]; uname = chat.uname; -- cgit v1.2.3