Changes suggested by code review. Added iPhone 4 screen size to iPhoneX test so Signal doesn't blow up in iPad's iPhone compatibility mode.

pull/1/head
Óscar Morales Vivó 6 years ago committed by Matthew Chen
parent eedaea7b2e
commit 4b98352a38

@ -220,10 +220,13 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
UILabel *emptyBoxLabel = [UILabel new]; UILabel *emptyBoxLabel = [UILabel new];
self.emptyBoxLabel = emptyBoxLabel; self.emptyBoxLabel = emptyBoxLabel;
[self.view addSubview: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 autoPinLeadingToSuperviewMargin];
[emptyBoxLabel autoPinTrailingToSuperviewMargin]; [emptyBoxLabel autoPinTrailingToSuperviewMargin];
[[[emptyBoxLabel centerYAnchor] constraintEqualToAnchor:[[self view] centerYAnchor]] setActive:YES]; [emptyBoxLabel autoPinVCenterToSuperviewVCenter];
UIRefreshControl *pullToRefreshView = [UIRefreshControl new]; UIRefreshControl *pullToRefreshView = [UIRefreshControl new];
pullToRefreshView.tintColor = [UIColor grayColor]; pullToRefreshView.tintColor = [UIColor grayColor];

@ -13,6 +13,9 @@ public extension UIDevice {
@objc @objc
public var isIPhoneX: Bool { public var isIPhoneX: Bool {
switch UIScreen.main.nativeBounds.height { switch UIScreen.main.nativeBounds.height {
case 960:
// iPad in iPhone compatibility mode (using old iPhone 4 screen size)
return false
case 1136: case 1136:
// iPhone 5 or 5S or 5C // iPhone 5 or 5S or 5C
return false return false

@ -88,6 +88,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
- (NSLayoutConstraint *)autoPinTopToSuperviewMarginWithInset:(CGFloat)margin; - (NSLayoutConstraint *)autoPinTopToSuperviewMarginWithInset:(CGFloat)margin;
- (NSLayoutConstraint *)autoPinBottomToSuperviewMargin; - (NSLayoutConstraint *)autoPinBottomToSuperviewMargin;
- (NSLayoutConstraint *)autoPinBottomToSuperviewMarginWithInset:(CGFloat)margin; - (NSLayoutConstraint *)autoPinBottomToSuperviewMarginWithInset:(CGFloat)margin;
- (NSLayoutConstraint *)autoPinVCenterToSuperviewVCenter;
- (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view; - (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view;
- (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view offset:(CGFloat)margin; - (NSLayoutConstraint *)autoPinLeadingToTrailingEdgeOfView:(UIView *)view offset:(CGFloat)margin;

@ -302,6 +302,14 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
return constraint; return constraint;
} }
- (NSLayoutConstraint *)autoPinVCenterToSuperviewVCenter {
self.translatesAutoresizingMaskIntoConstraints = NO;
NSLayoutConstraint *constraint = [self.centerYAnchor constraintEqualToAnchor:self.superview.centerYAnchor];
constraint.active = YES;
return constraint;
}
- (NSLayoutConstraint *)autoPinTopToSuperviewMargin - (NSLayoutConstraint *)autoPinTopToSuperviewMargin
{ {
return [self autoPinTopToSuperviewMarginWithInset:0.f]; return [self autoPinTopToSuperviewMarginWithInset:0.f];

Loading…
Cancel
Save