From 9d78e7d654c51c22ce4be87efef5bc1f8d5a2d08 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 31 Oct 2019 16:16:48 +0300 Subject: Fix authentication --- Juick/ViewControllers/NewPostViewController.m | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Juick/ViewControllers/NewPostViewController.m') diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index e4b5ac7..344e7b9 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -9,8 +9,6 @@ #import "NewPostViewController.h" #import "MessagesViewController.h" #import "QuoteView.h" -#import "APIClient.h" -#import "AppDelegate.h" NSString * const NewMessageNotificationName = @"NewMessage"; NSString * const ReplyPostedNotificationName = @"ReplyPosted"; @@ -47,8 +45,8 @@ NSString * const ReplyPostedNotificationName = @"ReplyPosted"; - (IBAction)sendAction:(id)sender { self.navigationItem.rightBarButtonItem.enabled = NO; if (_replyTo == nil) { - self.navigationItem.rightBarButtonItem.enabled = YES; - [[APIClient sharedClient] postMessage:self.textView.text result:^(Message *msg, NSError *err) { + [[AppDelegate shared].api postMessage:self.textView.text result:^(Message *msg, NSError *err) { + self.navigationItem.rightBarButtonItem.enabled = YES; if (!err) { [self dismissViewControllerAnimated:YES completion:^{ [[NSNotificationCenter defaultCenter] postNotificationName:NewMessageNotificationName object:msg]; @@ -60,7 +58,7 @@ NSString * const ReplyPostedNotificationName = @"ReplyPosted"; }]; } else { self.navigationItem.rightBarButtonItem.enabled = NO; - [[APIClient sharedClient] postReplyToThread:_replyTo.mid inReplyTo:_replyTo.rid text:self.textView.text result:^(Message *msg, NSError *err) { + [[AppDelegate shared].api postReplyToThread:_replyTo.mid inReplyTo:_replyTo.rid text:self.textView.text result:^(Message *msg, NSError *err) { if (!err) { [self dismissViewControllerAnimated:YES completion:^{ [[NSNotificationCenter defaultCenter] postNotificationName:ReplyPostedNotificationName object:msg]; -- cgit v1.2.3