From eedaea7b2e4fa19fbc44b883f1886d03f786f5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Morales=20Viv=C3=B3?= Date: Sat, 19 May 2018 21:35:06 -0700 Subject: [PATCH] Fixed leading/trailing margins for empty home view label. --- .../HomeView/HomeViewController.m | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index d470308690..938285b406 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -220,9 +220,10 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations UILabel *emptyBoxLabel = [UILabel new]; self.emptyBoxLabel = emptyBoxLabel; [self.view addSubview:emptyBoxLabel]; - [emptyBoxLabel autoPinWidthToSuperview]; - [emptyBoxLabel autoPinToTopLayoutGuideOfViewController:self withInset:0]; - [emptyBoxLabel autoPinToBottomLayoutGuideOfViewController:self withInset:0]; + [emptyBoxLabel setNumberOfLines:0]; // Let the label use as many lines as needed. It will very rarely be more than 2. + [emptyBoxLabel autoPinLeadingToSuperviewMargin]; + [emptyBoxLabel autoPinTrailingToSuperviewMargin]; + [[[emptyBoxLabel centerYAnchor] constraintEqualToAnchor:[[self view] centerYAnchor]] setActive:YES]; UIRefreshControl *pullToRefreshView = [UIRefreshControl new]; pullToRefreshView.tintColor = [UIColor grayColor]; @@ -1239,23 +1240,23 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations _emptyBoxLabel.textColor = [UIColor grayColor]; _emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f]; _emptyBoxLabel.textAlignment = NSTextAlignmentCenter; - _emptyBoxLabel.numberOfLines = 4; NSString *firstLine = @""; NSString *secondLine = @""; if (self.homeViewMode == HomeViewMode_Inbox) { 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", @""); secondLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TEXT", @""); } else { - // FIXME This looks wrong. Shouldn't we be showing inbox_title/text here? - firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TITLE", @""); - secondLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TEXT", @""); + // FIXME: Misleading localizable string key name. + 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", @"Second part of the label that shows up when there are neither active nor archived conversations"); } } else { 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", @""); secondLine = NSLocalizedString(@"EMPTY_INBOX_TEXT", @""); } else {