diff options
author | Vitaly Takmazov | 2018-04-08 14:31:34 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-08 16:28:02 +0300 |
commit | a18e9ee9a3dc8b7f8ed3074893eac788bc234903 (patch) | |
tree | d3390bbf778f243bd8ef15f19d22005a8356e375 | |
parent | 2a4770c84aaf2be9c58622f108007facef670fd3 (diff) |
fix PM push
-rw-r--r-- | Juick/AppDelegate.m | 4 | ||||
-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 | 14 | ||||
-rw-r--r-- | Juick/ViewControllers/NewPostViewController.m | 3 |
5 files changed, 20 insertions, 21 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index 7cfd052..3e92687 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -86,13 +86,15 @@ NSLog(@"User Info : %@", userInfo); [self parseNotificationPayload:userInfo]; UITabBarController *main = (UITabBarController *)self.window.rootViewController; - if (self.pushedThread > 0) { + if ([self.pushedThread integerValue] > 0) { [main setSelectedIndex:0]; UINavigationController *discover = (UINavigationController *)[main.viewControllers objectAtIndex:0]; [[discover.viewControllers objectAtIndex:0] performSegueWithIdentifier:@"threadViewSegue" sender:discover]; } else { + NSLog(@"Pushing to PM"); [main setSelectedIndex:1]; UINavigationController *dialogs = (UINavigationController *)[main.viewControllers objectAtIndex:1]; + NSLog(@"perform PM segue"); [[dialogs.viewControllers objectAtIndex:0] performSegueWithIdentifier:@"chatSegue" sender:dialogs]; } completionHandler(); diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index 40e9d10..cee6d40 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>57</string> + <string>64</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>LSApplicationCategoryType</key> 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]; }]; |