Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1189 from walsh2000/fix_1174_again
Browse files Browse the repository at this point in the history
Address #1174 & prevent inputToolbar-positioning regression
  • Loading branch information
jessesquires committed Sep 15, 2015
2 parents 611ef2d + b95e606 commit ac25bd4
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ @interface JSQMessagesViewController () <JSQMessagesInputToolbarDelegate,

@property (weak, nonatomic) UIGestureRecognizer *currentInteractivePopGestureRecognizer;

@property (assign, nonatomic) BOOL textViewWasFirstResponderDuringInteractivePop;

- (void)jsq_configureMessagesViewController;

- (NSString *)jsq_currentlyComposedMessageText;
Expand Down Expand Up @@ -260,13 +262,13 @@ - (void)viewDidAppear:(BOOL)animated
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self jsq_addActionToInteractivePopGestureRecognizer:NO];
self.collectionView.collectionViewLayout.springinessEnabled = NO;
}

- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[self jsq_addActionToInteractivePopGestureRecognizer:NO];
[self jsq_removeObservers];
[self.keyboardController endListeningForKeyboard];
}
Expand Down Expand Up @@ -844,6 +846,8 @@ - (void)jsq_handleInteractivePopGestureRecognizer:(UIGestureRecognizer *)gesture
[self.snapshotView removeFromSuperview];
}

self.textViewWasFirstResponderDuringInteractivePop = [self.inputToolbar.contentView.textView isFirstResponder];

[self.keyboardController endListeningForKeyboard];

if ([UIDevice jsq_isCurrentDeviceBeforeiOS8]) {
Expand All @@ -865,6 +869,9 @@ - (void)jsq_handleInteractivePopGestureRecognizer:(UIGestureRecognizer *)gesture
case UIGestureRecognizerStateEnded:
case UIGestureRecognizerStateFailed:
[self.keyboardController beginListeningForKeyboard];
if (self.textViewWasFirstResponderDuringInteractivePop) {
[self.inputToolbar.contentView.textView becomeFirstResponder];
}

if ([UIDevice jsq_isCurrentDeviceBeforeiOS8]) {
[self.snapshotView removeFromSuperview];
Expand Down

0 comments on commit ac25bd4

Please sign in to comment.