Merge branch 'charlesmchen/keyboardHeightVsContentInsets' into release/5.1.0
This commit is contained in:
commit
6168076df0
@ -187,11 +187,20 @@ public extension ConversationViewController {
|
||||
}
|
||||
}
|
||||
|
||||
bottomBarBottomConstraint?.constant = -inputAccessoryPlaceholder.keyboardOverlap
|
||||
guard let bottomBarBottomConstraint = bottomBarBottomConstraint,
|
||||
let bottomBarSuperview = bottomBar.superview else {
|
||||
return
|
||||
}
|
||||
let bottomBarPosition = -inputAccessoryPlaceholder.keyboardOverlap
|
||||
let didChange = bottomBarBottomConstraint.constant != bottomBarPosition
|
||||
guard didChange else {
|
||||
return
|
||||
}
|
||||
bottomBarBottomConstraint.constant = bottomBarPosition
|
||||
|
||||
// We always want to apply the new bottom bar position immediately,
|
||||
// as this only happens during animations (interactive or otherwise)
|
||||
bottomBar.superview?.layoutIfNeeded()
|
||||
bottomBarSuperview.layoutIfNeeded()
|
||||
}
|
||||
|
||||
@objc
|
||||
|
||||
@ -3934,12 +3934,24 @@ typedef enum : NSUInteger {
|
||||
[self handleKeyboardStateChange:animationDuration animationCurve:animationCurve];
|
||||
}
|
||||
|
||||
- (void)inputAccessoryPlaceholderKeyboardDidDismiss
|
||||
{
|
||||
[self updateBottomBarPosition];
|
||||
[self updateContentInsetsAnimated:NO];
|
||||
}
|
||||
|
||||
- (void)inputAccessoryPlaceholderKeyboardIsPresentingWithAnimationDuration:(NSTimeInterval)animationDuration
|
||||
animationCurve:(UIViewAnimationCurve)animationCurve
|
||||
{
|
||||
[self handleKeyboardStateChange:animationDuration animationCurve:animationCurve];
|
||||
}
|
||||
|
||||
- (void)inputAccessoryPlaceholderKeyboardDidPresent
|
||||
{
|
||||
[self updateBottomBarPosition];
|
||||
[self updateContentInsetsAnimated:NO];
|
||||
}
|
||||
|
||||
- (void)handleKeyboardStateChange:(NSTimeInterval)animationDuration animationCurve:(UIViewAnimationCurve)animationCurve
|
||||
{
|
||||
if (self.shouldAnimateKeyboardChanges && animationDuration > 0) {
|
||||
|
||||
@ -1033,10 +1033,18 @@ extension AttachmentApprovalViewController: InputAccessoryViewPlaceholderDelegat
|
||||
handleKeyboardStateChange(animationDuration: animationDuration, animationCurve: animationCurve)
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardDidPresent() {
|
||||
updateBottomToolViewPosition()
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardIsDismissing(animationDuration: TimeInterval, animationCurve: UIView.AnimationCurve) {
|
||||
handleKeyboardStateChange(animationDuration: animationDuration, animationCurve: animationCurve)
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardDidDismiss() {
|
||||
updateBottomToolViewPosition()
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardIsDismissingInteractively() {
|
||||
updateBottomToolViewPosition()
|
||||
}
|
||||
|
||||
@ -239,10 +239,18 @@ extension TextApprovalViewController: InputAccessoryViewPlaceholderDelegate {
|
||||
handleKeyboardStateChange(animationDuration: animationDuration, animationCurve: animationCurve)
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardDidPresent() {
|
||||
updateFooterViewPosition()
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardIsDismissing(animationDuration: TimeInterval, animationCurve: UIView.AnimationCurve) {
|
||||
handleKeyboardStateChange(animationDuration: animationDuration, animationCurve: animationCurve)
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardDidDismiss() {
|
||||
updateFooterViewPosition()
|
||||
}
|
||||
|
||||
func inputAccessoryPlaceholderKeyboardIsDismissingInteractively() {
|
||||
updateFooterViewPosition()
|
||||
}
|
||||
|
||||
@ -7,7 +7,9 @@ import Foundation
|
||||
@objc
|
||||
protocol InputAccessoryViewPlaceholderDelegate: class {
|
||||
func inputAccessoryPlaceholderKeyboardIsPresenting(animationDuration: TimeInterval, animationCurve: UIView.AnimationCurve)
|
||||
func inputAccessoryPlaceholderKeyboardDidPresent()
|
||||
func inputAccessoryPlaceholderKeyboardIsDismissing(animationDuration: TimeInterval, animationCurve: UIView.AnimationCurve)
|
||||
func inputAccessoryPlaceholderKeyboardDidDismiss()
|
||||
func inputAccessoryPlaceholderKeyboardIsDismissingInteractively()
|
||||
}
|
||||
|
||||
@ -75,9 +77,11 @@ public class InputAccessoryViewPlaceholder: UIView {
|
||||
set {
|
||||
guard newValue != desiredHeight else { return }
|
||||
heightConstraint.constant = newValue
|
||||
heightConstraintView.layoutIfNeeded()
|
||||
self.layoutIfNeeded()
|
||||
superview?.layoutIfNeeded()
|
||||
UIView.performWithoutAnimation {
|
||||
heightConstraintView.layoutIfNeeded()
|
||||
self.layoutIfNeeded()
|
||||
superview?.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
get {
|
||||
return heightConstraint.constant
|
||||
@ -215,6 +219,7 @@ public class InputAccessoryViewPlaceholder: UIView {
|
||||
@objc
|
||||
private func keyboardDidPresent(_ notification: Notification) {
|
||||
keyboardState = .presented
|
||||
delegate?.inputAccessoryPlaceholderKeyboardDidPresent()
|
||||
}
|
||||
|
||||
@objc
|
||||
@ -234,5 +239,6 @@ public class InputAccessoryViewPlaceholder: UIView {
|
||||
@objc
|
||||
private func keyboardDidDismiss(_ notification: Notification) {
|
||||
keyboardState = .dismissed
|
||||
delegate?.inputAccessoryPlaceholderKeyboardDidDismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user