From 79d594b4d31d978bbbc7622c844b95116c6e71ec Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 9 Apr 2019 13:38:39 -0400 Subject: [PATCH] Ensure that conversation view's content insets reserve space for input accessory view when app is inactive. --- .../ConversationViewController.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 993748c21..a5f9b69e1 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3849,6 +3849,24 @@ typedef enum : NSUInteger { // Therefore, we only zero out the contentInsetBottom if the inputAccessoryView is nil. if (self.inputAccessoryView == nil || keyboardContentOverlap > 0) { self.contentInsetBottom = keyboardContentOverlap; + } else if (!CurrentAppContext().isAppForegroundAndActive) { + // If app is not active, we'll dismiss the keyboard + // so only reserve enough space for the input accessory + // view. Otherwise, the content will animate into place + // when the app returns from the background. + // + // NOTE: There are two separate cases. If the keyboard is + // dismissed, the inputAccessoryView grows to allow + // space for the notch. In this case, we need to + // subtract bottomLayoutGuide. However, if the + // keyboard is presented we don't want to do that. + // I don't see a simple, safe way to distinguish + // these two cases. Therefore, I'm _always_ + // subtracting bottomLayoutGuide. This will cause + // a slight animation when returning to the app + // but it will "match" the presentation animation + // of the input accessory. + self.contentInsetBottom = MAX(0, self.inputAccessoryView.height - self.bottomLayoutGuide.length); } newInsets.top = 0 + self.extraContentInsetPadding;