diff --git a/Classes/Issues/IssuesViewController.swift b/Classes/Issues/IssuesViewController.swift index 017a0db2..b6a06b00 100644 --- a/Classes/Issues/IssuesViewController.swift +++ b/Classes/Issues/IssuesViewController.swift @@ -85,6 +85,10 @@ IssueNeckLoadSectionControllerDelegate { rightButton.setTitle(NSLocalizedString("Send", comment: ""), for: .normal) rightButton.setTitleColor(Styles.Colors.Blue.medium.color, for: .normal) + collectionView?.keyboardDismissMode = .interactive + + NotificationCenter.default.addObserver(self, selector: #selector(IssuesViewController.onKeyboardChange(notification:)), name: NSNotification.Name.UIKeyboardDidChangeFrame, object: nil) + // displayed once an add comment client is created (requires a gql subject id) setTextInputbarHidden(true, animated: false) @@ -98,6 +102,10 @@ IssueNeckLoadSectionControllerDelegate { navigationItem.rightBarButtonItem = rightItem } + func onKeyboardChange(notification: NSNotification) { + print(notification.userInfo) + } + override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() feed.viewWillLayoutSubviews(view: view) diff --git a/Resources/Info.plist b/Resources/Info.plist index bddc27eb..62f33ec5 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -32,7 +32,7 @@ CFBundleVersion - 1174 + 1180 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/SlackTextViewController/Source/SLKInputAccessoryView.m b/SlackTextViewController/Source/SLKInputAccessoryView.m index 0e1727b9..d4b08105 100755 --- a/SlackTextViewController/Source/SLKInputAccessoryView.m +++ b/SlackTextViewController/Source/SLKInputAccessoryView.m @@ -12,13 +12,17 @@ @implementation SLKInputAccessoryView -#pragma mark - Super Overrides +//#pragma mark - Super Overrides +// +//- (void)willMoveToSuperview:(UIView *)newSuperview +//{ +// if (!SLK_IS_IOS9_AND_HIGHER) { +// _keyboardViewProxy = newSuperview; +// } +//} -- (void)willMoveToSuperview:(UIView *)newSuperview -{ - if (!SLK_IS_IOS9_AND_HIGHER) { - _keyboardViewProxy = newSuperview; - } +- (UIView *)keyboardViewProxy { + return self.superview; } -@end \ No newline at end of file +@end diff --git a/SlackTextViewController/Source/SLKTextViewController.m b/SlackTextViewController/Source/SLKTextViewController.m index a759b873..96b8ffa7 100755 --- a/SlackTextViewController/Source/SLKTextViewController.m +++ b/SlackTextViewController/Source/SLKTextViewController.m @@ -918,7 +918,32 @@ CGFloat const SLKAutoCompletionViewDefaultHeight = 140.0; }); } -- (void)slk_handlePanGestureRecognizer:(UIPanGestureRecognizer *)gesture +- (void)slk_handlePanGestureRecognizer:(UIPanGestureRecognizer *)gesture { + UIView *kb = _textInputbar.inputAccessoryView.superview; + + if (kb == nil) { + return; + } + + switch (gesture.state) { + case UIGestureRecognizerStateChanged: { + [UIView performWithoutAnimation:^{ + self.keyboardHC.constant = [self slk_appropriateKeyboardHeightFromRect:kb.frame]; + self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight]; + [self.view layoutIfNeeded]; + }]; + } + break; + case UIGestureRecognizerStateBegan: + case UIGestureRecognizerStatePossible: + case UIGestureRecognizerStateCancelled: + case UIGestureRecognizerStateEnded: + case UIGestureRecognizerStateFailed: + break; + } +} + +- (void)OLD_slk_handlePanGestureRecognizer:(UIPanGestureRecognizer *)gesture { // Local variables static CGPoint startPoint; @@ -927,7 +952,7 @@ CGFloat const SLKAutoCompletionViewDefaultHeight = 140.0; static BOOL presenting = NO; __block UIView *keyboardView = [_textInputbar.inputAccessoryView keyboardViewProxy]; - + // When no keyboard view has been detecting, let's skip any handling. if (!keyboardView) { return; @@ -984,7 +1009,7 @@ CGFloat const SLKAutoCompletionViewDefaultHeight = 140.0; // And move the keyboard to the bottom edge // TODO: Fix an occasional layout glitch when the keyboard appears for the first time. - keyboardView.frame = originalFrame; +// keyboardView.frame = originalFrame; } break; @@ -1020,8 +1045,8 @@ CGFloat const SLKAutoCompletionViewDefaultHeight = 140.0; keyboardFrame.origin.y = keyboardMinY; } - keyboardView.frame = keyboardFrame; - +// keyboardView.frame = keyboardFrame; + self.keyboardHC.constant = [self slk_appropriateKeyboardHeightFromRect:keyboardFrame]; self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight]; @@ -1080,7 +1105,7 @@ CGFloat const SLKAutoCompletionViewDefaultHeight = 140.0; options:UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionBeginFromCurrentState animations:^{ [self.view layoutIfNeeded]; - keyboardView.frame = keyboardFrame; +// keyboardView.frame = keyboardFrame; } completion:^(BOOL finished) { if (hide) {