|
|
|
@ -213,6 +213,7 @@ typedef enum : NSUInteger {
|
|
|
|
|
@property (nonatomic) BOOL isShowingSearchUI;
|
|
|
|
|
@property (nonatomic, nullable) MenuActionsViewController *menuActionsViewController;
|
|
|
|
|
@property (nonatomic) CGFloat extraContentInsetPadding;
|
|
|
|
|
@property (nonatomic) CGFloat contentInsetBottom;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
@ -1262,7 +1263,7 @@ typedef enum : NSUInteger {
|
|
|
|
|
// until `viewDidDisappear`.
|
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated
|
|
|
|
|
{
|
|
|
|
|
OWSLogDebug(@"viewWillDisappear");
|
|
|
|
|
OWSLogDebug(@"");
|
|
|
|
|
|
|
|
|
|
[super viewWillDisappear:animated];
|
|
|
|
|
|
|
|
|
@ -1273,6 +1274,8 @@ typedef enum : NSUInteger {
|
|
|
|
|
|
|
|
|
|
- (void)viewDidDisappear:(BOOL)animated
|
|
|
|
|
{
|
|
|
|
|
OWSLogDebug(@"");
|
|
|
|
|
|
|
|
|
|
[super viewDidDisappear:animated];
|
|
|
|
|
self.userHasScrolled = NO;
|
|
|
|
|
self.isViewVisible = NO;
|
|
|
|
@ -3847,18 +3850,26 @@ typedef enum : NSUInteger {
|
|
|
|
|
UIEdgeInsets oldInsets = self.collectionView.contentInset;
|
|
|
|
|
UIEdgeInsets newInsets = oldInsets;
|
|
|
|
|
|
|
|
|
|
// Use a content inset that so that the conversation content
|
|
|
|
|
// is not hidden behind the keyboard + input accessory.
|
|
|
|
|
// Measures how far the keyboard "intrudes" into the collection view's content region.
|
|
|
|
|
// Indicates how large the bottom content inset should be in order to avoid the keyboard
|
|
|
|
|
// from hiding the conversation content.
|
|
|
|
|
//
|
|
|
|
|
// Make sure to leave space for the bottom layout guide (the notch).
|
|
|
|
|
// NOTE: we can ignore the "bottomLayoutGuide" (i.e. the notch); this will be accounted
|
|
|
|
|
// for by the "adjustedContentInset".
|
|
|
|
|
CGFloat keyboardContentOverlap
|
|
|
|
|
= MAX(0, self.view.height - self.bottomLayoutGuide.length - keyboardEndFrameConverted.origin.y);
|
|
|
|
|
|
|
|
|
|
// For the sake of continuity, we want to maintain the same contentInsetBottom when the
|
|
|
|
|
// the keyboard/input accessory are hidden, e.g. during dismissal animations, when
|
|
|
|
|
// presenting popups like the attachment picker, etc.
|
|
|
|
|
//
|
|
|
|
|
// Always reserve room for the input accessory, which we display even
|
|
|
|
|
// if the keyboard is not active.
|
|
|
|
|
newInsets.top = 0;
|
|
|
|
|
newInsets.bottom = MAX(0, self.view.height - self.bottomLayoutGuide.length - keyboardEndFrameConverted.origin.y);
|
|
|
|
|
// Therefore, we only zero out the contentInsetBottom if the inputAccessoryView is nil.
|
|
|
|
|
if (self.inputAccessoryView == nil || keyboardContentOverlap > 0) {
|
|
|
|
|
self.contentInsetBottom = keyboardContentOverlap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newInsets.top += self.extraContentInsetPadding;
|
|
|
|
|
newInsets.bottom += self.extraContentInsetPadding;
|
|
|
|
|
newInsets.top = 0 + self.extraContentInsetPadding;
|
|
|
|
|
newInsets.bottom = self.contentInsetBottom + self.extraContentInsetPadding;
|
|
|
|
|
|
|
|
|
|
BOOL wasScrolledToBottom = [self isScrolledToBottom];
|
|
|
|
|
|
|
|
|
|