diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index 938285b40..65fe725cf 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -220,10 +220,13 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations UILabel *emptyBoxLabel = [UILabel new]; self.emptyBoxLabel = emptyBoxLabel; [self.view addSubview:emptyBoxLabel]; - [emptyBoxLabel setNumberOfLines:0]; // Let the label use as many lines as needed. It will very rarely be more than 2. + + // Let the label use as many lines as needed. It will very rarely be more than 2 but may happen for verbose locs. + [emptyBoxLabel setNumberOfLines:0]; + [emptyBoxLabel autoPinLeadingToSuperviewMargin]; [emptyBoxLabel autoPinTrailingToSuperviewMargin]; - [[[emptyBoxLabel centerYAnchor] constraintEqualToAnchor:[[self view] centerYAnchor]] setActive:YES]; + [emptyBoxLabel autoPinVCenterToSuperviewVCenter]; UIRefreshControl *pullToRefreshView = [UIRefreshControl new]; pullToRefreshView.tintColor = [UIColor grayColor]; diff --git a/SignalMessaging/categories/UIDevice+featureSupport.swift b/SignalMessaging/categories/UIDevice+featureSupport.swift index 96046e04e..916e026b2 100644 --- a/SignalMessaging/categories/UIDevice+featureSupport.swift +++ b/SignalMessaging/categories/UIDevice+featureSupport.swift @@ -13,6 +13,9 @@ public extension UIDevice { @objc public var isIPhoneX: Bool { switch UIScreen.main.nativeBounds.height { + case 960: + // iPad in iPhone compatibility mode (using old iPhone 4 screen size) + return false case 1136: // iPhone 5 or 5S or 5C return false diff --git a/SignalMessaging/categories/UIView+OWS.h b/SignalMessaging/categories/UIView+OWS.h index 311e2d1bc..8e62cb30e 100644 --- a/SignalMessaging/categories/UIView+OWS.h +++ b/SignalMessaging/categories/UIView+OWS.h @@ -88,6 +88,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value); - (NSLayoutConstraint *)autoPinTopToSuperviewMarginWithInset:(CGFloat)margin; - (NSLayoutConstraint *)autoPinBottomToSuperviewMargin; - (NSLayoutConstraint *)autoPinBottomToSuperviewMarginWithInset:(CGFloat)margin; +- (NSLayoutConstraint *)autoPinVCenterToSuperviewVCenter; - (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view; - (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view offset:(CGFloat)margin; diff --git a/SignalMessaging/categories/UIView+OWS.m b/SignalMessaging/categories/UIView+OWS.m index d99cadd3a..3e3a198c2 100644 --- a/SignalMessaging/categories/UIView+OWS.m +++ b/SignalMessaging/categories/UIView+OWS.m @@ -302,6 +302,14 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) return constraint; } +- (NSLayoutConstraint *)autoPinVCenterToSuperviewVCenter { + self.translatesAutoresizingMaskIntoConstraints = NO; + + NSLayoutConstraint *constraint = [self.centerYAnchor constraintEqualToAnchor:self.superview.centerYAnchor]; + constraint.active = YES; + return constraint; +} + - (NSLayoutConstraint *)autoPinTopToSuperviewMargin { return [self autoPinTopToSuperviewMarginWithInset:0.f];