diff options
author | Vitaly Takmazov | 2019-10-03 15:16:18 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-10-03 15:16:18 +0300 |
commit | a5c35479e144eef8bea9f80a10dfeb7a860763f1 (patch) | |
tree | 1fa25fd810b07cd72ffd93880206fb08c78da96d /Juick/ViewControllers/ChatViewController.m | |
parent | 19675633bce3dc7f7e4ff9712eff3938065e868c (diff) |
Drop PHFComposeBarView
Diffstat (limited to 'Juick/ViewControllers/ChatViewController.m')
-rw-r--r-- | Juick/ViewControllers/ChatViewController.m | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m index 989b531..2612719 100644 --- a/Juick/ViewControllers/ChatViewController.m +++ b/Juick/ViewControllers/ChatViewController.m @@ -10,9 +10,11 @@ #import "BubbleMessageCell.h" #import "APIClient.h" +#import "MessageInputView.h" + @interface ChatViewController () -@property (nonatomic, readwrite, retain) UIView *inputAccessoryView; +@property (nonatomic, readwrite, retain) MessageInputView *accessoryView; @property (nonatomic, strong) NSString *me; @end @@ -26,6 +28,7 @@ self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive; self.tableView.allowsSelection = NO; + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; self.me = [APIClient sharedClient].credential.user; [self reloadChat]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil]; @@ -77,15 +80,16 @@ return YES; } +- (BOOL)canResignFirstResponder { + return YES; +} + - (UIView *) inputAccessoryView { - if (!_inputAccessoryView) { - PHFComposeBarView *composeView = [[PHFComposeBarView alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - PHFComposeBarViewInitialHeight, self.view.bounds.size.width, PHFComposeBarViewInitialHeight)]; - composeView.delegate = self; - [composeView.bottomAnchor constraintEqualToSystemSpacingBelowAnchor:self.view.safeAreaLayoutGuide.bottomAnchor multiplier:1.0f]; - composeView.maxLinesCount = 4; - _inputAccessoryView = composeView; + if (!_accessoryView) { + _accessoryView = [[[NSBundle mainBundle] loadNibNamed:@"MessageInputView" owner:self options:nil] firstObject]; + _accessoryView.delegate = self; } - return _inputAccessoryView; + return _accessoryView; } -(void) keyboardWillChangeFrame:(NSNotification *)notification { @@ -102,12 +106,11 @@ } } --(void) composeBarViewDidPressButton:(PHFComposeBarView *)composeBarView { - [[APIClient sharedClient] postPMToUser:self.uname text:composeBarView.text result:^(NSError *err) { +-(void) textSent:(NSString *)text { + [[APIClient sharedClient] postPMToUser:self.uname text:text result:^(NSError *err) { if (!err) { NSLog(@"Success!"); - [composeBarView becomeFirstResponder]; - [composeBarView setText:nil animated:NO]; + [self.accessoryView becomeFirstResponder]; [self reloadChat]; } }]; |