slack tv dismisses w/ interactive mode (attempt 1)

This commit is contained in:
Ryan Nystrom
2017-07-31 08:59:29 -06:00
parent 4233d5a6cd
commit af950b417b
4 changed files with 51 additions and 14 deletions

View File

@@ -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
@end

View File

@@ -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) {