Respond to CR.

This commit is contained in:
Matthew Chen 2018-04-09 14:56:33 -04:00
parent eb400114c2
commit 644e78f19d
7 changed files with 33 additions and 22 deletions

View File

@ -46,13 +46,7 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 70;
// Fix a bug that only affects iOS 11.0.x and 11.1.x.
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0) && !SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 2)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
#pragma clang diagnostic pop
}
[self.tableView applyScrollViewInsetsFix];
self.dbConnection = [[OWSPrimaryStorage sharedManager] newDatabaseConnection];
[self.dbConnection beginLongLivedReadTransaction];

View File

@ -521,13 +521,7 @@ typedef enum : NSUInteger {
[self.collectionView autoPinWidthToSuperview];
[self.collectionView autoPinToTopLayoutGuideOfViewController:self withInset:0];
// Fix a bug that only affects iOS 11.0.x and 11.1.x.
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0) && !SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 2)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
self.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
#pragma clang diagnostic pop
}
[self.collectionView applyScrollViewInsetsFix];
_inputToolbar = [ConversationInputToolbar new];
self.inputToolbar.inputToolbarDelegate = self;

View File

@ -216,7 +216,7 @@ NS_ASSUME_NONNULL_BEGIN
scrollView.decelerationRate = UIScrollViewDecelerationRateFast;
if (@available(iOS 11.0, *)) {
scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
[scrollView contentInsetAdjustmentBehavior];
} else {
self.automaticallyAdjustsScrollViewInsets = NO;
}

View File

@ -146,6 +146,8 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
]
} else {
scrollView.applyInsetsFix()
scrollView.autoPinEdge(toSuperviewEdge: .bottom)
}

View File

@ -452,13 +452,9 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
// Fix a bug that only affects iOS 11.0.x and 11.1.x.
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0) && !SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 2)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
#pragma clang diagnostic pop
}
[self.tableView applyScrollViewInsetsFix];
[self.view addSubview:self.tableView];
[self.tableView autoPinWidthToSuperview];
[self.tableView autoPinToTopLayoutGuideOfViewController:self withInset:0];

View File

@ -125,6 +125,14 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
@end
#pragma mark -
@interface UIScrollView (OWS)
- (void)applyScrollViewInsetsFix;
@end
#pragma mark - Macros
CG_INLINE CGSize CGSizeCeil(CGSize size)

View File

@ -487,4 +487,21 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
@end
#pragma mark -
@implementation UIScrollView (OWS)
- (void)applyScrollViewInsetsFix
{
// Fix a bug that only affects iOS 11.0.x and 11.1.x.
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0) && !SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 2)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
#pragma clang diagnostic pop
}
}
@end
NS_ASSUME_NONNULL_END