Fixed leading/trailing margins for empty home view label.

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

@ -220,9 +220,10 @@ 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 autoPinWidthToSuperview]; [emptyBoxLabel setNumberOfLines:0]; // Let the label use as many lines as needed. It will very rarely be more than 2.
[emptyBoxLabel autoPinToTopLayoutGuideOfViewController:self withInset:0]; [emptyBoxLabel autoPinLeadingToSuperviewMargin];
[emptyBoxLabel autoPinToBottomLayoutGuideOfViewController:self withInset:0]; [emptyBoxLabel autoPinTrailingToSuperviewMargin];
[[[emptyBoxLabel centerYAnchor] constraintEqualToAnchor:[[self view] centerYAnchor]] setActive:YES];
UIRefreshControl *pullToRefreshView = [UIRefreshControl new]; UIRefreshControl *pullToRefreshView = [UIRefreshControl new];
pullToRefreshView.tintColor = [UIColor grayColor]; pullToRefreshView.tintColor = [UIColor grayColor];
@ -1239,23 +1240,23 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
_emptyBoxLabel.textColor = [UIColor grayColor]; _emptyBoxLabel.textColor = [UIColor grayColor];
_emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f]; _emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f];
_emptyBoxLabel.textAlignment = NSTextAlignmentCenter; _emptyBoxLabel.textAlignment = NSTextAlignmentCenter;
_emptyBoxLabel.numberOfLines = 4;
NSString *firstLine = @""; NSString *firstLine = @"";
NSString *secondLine = @""; NSString *secondLine = @"";
if (self.homeViewMode == HomeViewMode_Inbox) { if (self.homeViewMode == HomeViewMode_Inbox) {
if ([Environment.preferences getHasSentAMessage]) { if ([Environment.preferences getHasSentAMessage]) {
// FIXME: This doesn't appear to ever show up as the defaults flag is never set (setHasSentAMessage: is never called).
firstLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TITLE", @""); firstLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TITLE", @"");
secondLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TEXT", @""); secondLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TEXT", @"");
} else { } else {
// FIXME This looks wrong. Shouldn't we be showing inbox_title/text here? // FIXME: Misleading localizable string key name.
firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TITLE", @""); firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TITLE", @"First (bolded) part of the label that shows up when there are neither active nor archived conversations");
secondLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TEXT", @""); secondLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TEXT", @"Second part of the label that shows up when there are neither active nor archived conversations");
} }
} else { } else {
if ([Environment.preferences getHasArchivedAMessage]) { if ([Environment.preferences getHasArchivedAMessage]) {
// FIXME This looks wrong. Shouldn't we be showing first_archive_title/text here? // FIXME: Shows up after the archival tab is cleared up completely by the user, the localizable string key is misleading.
firstLine = NSLocalizedString(@"EMPTY_INBOX_TITLE", @""); firstLine = NSLocalizedString(@"EMPTY_INBOX_TITLE", @"");
secondLine = NSLocalizedString(@"EMPTY_INBOX_TEXT", @""); secondLine = NSLocalizedString(@"EMPTY_INBOX_TEXT", @"");
} else { } else {

Loading…
Cancel
Save