summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/NewPostViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-02 00:31:43 +0300
committerGravatar Vitaly Takmazov2018-04-02 00:31:43 +0300
commitf153a400634d4aa726dafd2257921b904c92824b (patch)
tree51ed90b89ccd0eebc4abc85a2e888b65009d34a1 /Juick/ViewControllers/NewPostViewController.m
parentc623f12b2d5e95708a3971e642410c9098f71285 (diff)
multiple fixes
Diffstat (limited to 'Juick/ViewControllers/NewPostViewController.m')
-rw-r--r--Juick/ViewControllers/NewPostViewController.m24
1 files changed, 7 insertions, 17 deletions
diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m
index 02d810b..7b80a52 100644
--- a/Juick/ViewControllers/NewPostViewController.m
+++ b/Juick/ViewControllers/NewPostViewController.m
@@ -31,35 +31,25 @@
if (_replyTo != nil) {
MessageInputView *inputView = (MessageInputView *) self.inputAccessoryView;
inputView.quoteText.text = _replyTo.text;
- self.navigationController.visibleViewController.title = [NSString stringWithFormat:@"Reply to %@", _replyTo.user.uname];
+ self.title = [NSString stringWithFormat:@"Reply to %@", _replyTo.user.uname];
} else {
- self.navigationController.visibleViewController.title = @"Post";
+ self.title = @"Post";
}
- self.navigationController.visibleViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
- target:self action:@selector(cancelCompose)];
- self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Send" style:UIBarButtonItemStyleDone target:self action:@selector(doneCompose)];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
[self.textView becomeFirstResponder];
}
-- (void) cancelCompose {
- [self.textView resignFirstResponder];
- [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES];
-}
-
-- (void) doneCompose {
+- (IBAction)sendAction:(id)sender {
if (_replyTo == nil) {
[[APIClient sharedClient] postMessage:self.textView.text result:^(Message *msg, NSError *err) {
- [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES];
- MessagesViewController *target = (MessagesViewController *)self.navigationController.visibleViewController;
- [target refreshData: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.visibleViewController.navigationController popViewControllerAnimated:YES];
- MessagesViewController *target = (MessagesViewController *)self.navigationController.visibleViewController;
- [target refreshData:YES];
+ [self.navigationController popViewControllerAnimated:YES];
+ [(MessagesViewController *)self.navigationController.visibleViewController refreshData:YES];
}];
}
}