diff options
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 18 | ||||
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.m | 14 | ||||
-rw-r--r-- | Juick/ViewControllers/NewPostViewController.m | 3 |
3 files changed, 16 insertions, 19 deletions
diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index 5369a65..a36acf3 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -13,13 +13,6 @@ #import "APIClient.h" #import "AppDelegate.h" -@interface DialogsViewController () - - -@property(nonatomic, strong) AppDelegate *appDelegate; - -@end - @implementation DialogsViewController - (void)viewDidLoad { [super viewDidLoad]; @@ -40,7 +33,6 @@ [self.tableView endUpdates]; } }]; - self.appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate; } #pragma mark - Table view data source @@ -66,10 +58,12 @@ -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"chatSegue"]) { NSString *uname; - if ([self.appDelegate.pushedUname length] > 0) { - uname = [self.appDelegate.pushedUname copy]; - self.appDelegate.pushedThread = nil; - self.appDelegate.pushedUname = nil; + AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; + NSLog(@"pushed name is %@", appDelegate.pushedUname); + if ([appDelegate.pushedUname length] > 0) { + uname = [appDelegate.pushedUname copy]; + appDelegate.pushedThread = nil; + appDelegate.pushedUname = nil; } else { Chat *chat = [self.chats objectAtIndex:[self.tableView indexPathForSelectedRow].row]; uname = chat.uname; diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m index afbf32e..110d8c7 100644 --- a/Juick/ViewControllers/DiscoverViewController.m +++ b/Juick/ViewControllers/DiscoverViewController.m @@ -14,12 +14,12 @@ @interface DiscoverViewController () +@property(nonatomic, strong) AppDelegate *appDelegate; + @end @implementation DiscoverViewController -AppDelegate *appDelegate; - -(void) viewDidLoad { [super viewDidLoad]; self.messagesDelegate = self; @@ -45,7 +45,7 @@ AppDelegate *appDelegate; } [self refreshData:NO]; } - appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate; + self.appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate; } -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { @@ -58,10 +58,10 @@ AppDelegate *appDelegate; if ([segue.identifier isEqual: @"threadViewSegue"]) { NSNumber *mid; BOOL scrollToEnd = NO; - if (appDelegate.pushedThread != nil) { - mid = [appDelegate.pushedThread copy]; - appDelegate.pushedThread = nil; - appDelegate.pushedUname = nil; + if (self.appDelegate.pushedThread != nil) { + mid = [self.appDelegate.pushedThread copy]; + self.appDelegate.pushedThread = nil; + self.appDelegate.pushedUname = nil; scrollToEnd = YES; } else { Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 7b80a52..81121ec 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -41,13 +41,16 @@ } - (IBAction)sendAction:(id)sender { + self.navigationController.navigationItem.rightBarButtonItem.enabled = NO; if (_replyTo == nil) { [[APIClient sharedClient] postMessage:self.textView.text result:^(Message *msg, NSError *err) { + self.navigationController.navigationItem.rightBarButtonItem.enabled = YES; [self.navigationController popViewControllerAnimated:YES]; [(MessagesViewController *)self.navigationController.visibleViewController refreshData:YES]; }]; } else { [[APIClient sharedClient] postReplyToThread:_replyTo.mid inReplyTo:_replyTo.rid text:self.textView.text result:^(Message *msg, NSError *err) { + self.navigationController.navigationItem.rightBarButtonItem.enabled = YES; [self.navigationController popViewControllerAnimated:YES]; [(MessagesViewController *)self.navigationController.visibleViewController refreshData:YES]; }]; |