Fix conversation view keyboard.

pull/1/head
Matthew Chen 6 years ago
parent bf0d92acfb
commit cb228bdd29

@ -367,10 +367,31 @@ typedef enum : NSUInteger {
selector:@selector(profileWhitelistDidChange:) selector:@selector(profileWhitelistDidChange:)
name:kNSNotificationName_ProfileWhitelistDidChange name:kNSNotificationName_ProfileWhitelistDidChange
object:nil]; object:nil];
// Keyboard events.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidHide:)
name:UIKeyboardDidHideNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillChangeFrame:) selector:@selector(keyboardWillChangeFrame:)
name:UIKeyboardWillChangeFrameNotification name:UIKeyboardWillChangeFrameNotification
object:nil]; object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidChangeFrame:)
name:UIKeyboardDidChangeFrameNotification
object:nil];
} }
- (BOOL)isGroupConversation - (BOOL)isGroupConversation
@ -3589,12 +3610,33 @@ typedef enum : NSUInteger {
}); });
} }
- (void)keyboardWillShow:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardDidShow:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardWillHide:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardDidHide:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardWillChangeFrame:(NSNotification *)notification - (void)keyboardWillChangeFrame:(NSNotification *)notification
{ {
// `willChange` is the correct keyboard notifiation to observe when adjusting contentInset [self handleKeyboardNotification:notification];
// in lockstep with the keyboard presentation animation. `didChange` results in the contentInset }
// not adjusting until after the keyboard is fully up.
OWSLogVerbose(@""); - (void)keyboardDidChangeFrame:(NSNotification *)notification
{
[self handleKeyboardNotification:notification]; [self handleKeyboardNotification:notification];
} }

Loading…
Cancel
Save