Merge branch 'charlesmchen/profileViewsVsKeyboard' into release/5.3.0

This commit is contained in:
Matthew Chen 2021-01-21 20:50:36 -03:00
commit fcfaa1fa05
4 changed files with 14 additions and 3 deletions

View File

@ -43,6 +43,8 @@ class ProfileBioViewController: OWSTableViewController {
self.bioTextField.text = bio
self.bioEmojiLabel.text = bioEmoji
self.shouldAvoidKeyboard = true
}
// MARK: - Orientation

View File

@ -73,6 +73,8 @@ public class ProfileViewController: OWSTableViewController {
self.completionHandler = completionHandler
super.init()
self.shouldAvoidKeyboard = true
}
// MARK: - Orientation

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
//
#import <SignalMessaging/OWSViewController.h>
@ -195,6 +195,8 @@ typedef BOOL (^OWSTableSwitchBlock)(void);
@property (nonatomic, nullable) UIColor *customSectionHeaderFooterBackgroundColor;
@property (nonatomic) BOOL shouldAvoidKeyboard;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
#pragma mark - Presentation

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
//
#import "OWSTableViewController.h"
@ -607,7 +607,12 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
// We don't need a top or bottom insets, since we pin to the top and bottom layout guides.
self.automaticallyAdjustsScrollViewInsets = NO;
} else {
[self.tableView autoPinEdgesToSuperviewEdges];
if (self.shouldAvoidKeyboard) {
[self.tableView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom];
[self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableView avoidNotch:YES];
} else {
[self.tableView autoPinEdgesToSuperviewEdges];
}
}
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kOWSTableCellIdentifier];