diff --git a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift index 12e3db337..f90cda99c 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift @@ -74,7 +74,7 @@ public class ConversationHeaderView: UIStackView { textRows.distribution = .fillProportionally textRows.spacing = 0 - textRows.layoutMargins = UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 4) + textRows.layoutMargins = UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 8) textRows.isLayoutMarginsRelativeArrangement = true // low content hugging so that the text rows push container to the right bar button item(s) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index af6b4774c..5e86e5cce 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -274,6 +274,18 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations break; } + [self applyDefaultBackButton]; + + if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] + && (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) { + [self registerForPreviewingWithDelegate:self sourceView:self.tableView]; + } + + [self updateBarButtonItems]; +} + +- (void)applyDefaultBackButton +{ // We don't show any text for the back button, so there's no need to localize it. But because we left align the // conversation title view, we add a little tappable padding after the back button, by having a title of spaces. // Admittedly this is kind of a hack and not super fine grained, but it's simple and results in the interactive pop @@ -284,13 +296,15 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:paddingString style:UIBarButtonItemStylePlain target:nil action:nil]; +} - if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] - && (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) { - [self registerForPreviewingWithDelegate:self sourceView:self.tableView]; - } - - [self updateBarButtonItems]; +- (void)applyArchiveBackButton +{ + self.navigationItem.backBarButtonItem = + [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BACK_BUTTON", @"button text for back button") + style:UIBarButtonItemStylePlain + target:nil + action:nil]; } - (void)viewDidAppear:(BOOL)animated @@ -298,6 +312,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations [super viewDidAppear:animated]; [self displayAnyUnseenUpgradeExperience]; + [self applyDefaultBackButton]; } - (void)updateBarButtonItems @@ -408,6 +423,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; + __block BOOL hasAnyMessages; [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction * _Nonnull transaction) { hasAnyMessages = [self hasAnyMessagesWithTransaction:transaction]; @@ -442,6 +458,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations } [self checkIfEmptyView]; + [self applyDefaultBackButton]; } - (void)viewWillDisappear:(BOOL)animated @@ -985,6 +1002,10 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations { OWSAssert(self.homeViewMode == HomeViewMode_Inbox); + // When showing archived conversations, we want to use a conventional "back" button + // to return to the "inbox" home view. + [self applyArchiveBackButton]; + // Push a separate instance of this view using "archive" mode. HomeViewController *homeView = [HomeViewController new]; homeView.homeViewMode = HomeViewMode_Archive; diff --git a/Signal/src/views/ReminderView.swift b/Signal/src/views/ReminderView.swift index 4f515ee46..40a2f86e2 100644 --- a/Signal/src/views/ReminderView.swift +++ b/Signal/src/views/ReminderView.swift @@ -79,17 +79,29 @@ class ReminderView: UIView { self.addSubview(container) container.autoPinWidthToSuperview(withMargin: 16) - container.autoPinHeightToSuperview(withMargin: 16) + switch (mode) { + case .nag: + container.autoPinHeightToSuperview(withMargin: 16) + case .explanation: + container.autoPinHeightToSuperview(withMargin: 12) + } + + // Margin: top and bottom 12 left and right 16. // Label - label.font = UIFont.ows_regularFont(withSize: 14) + switch (mode) { + case .nag: + label.font = UIFont.ows_regularFont(withSize: 14) + case .explanation: + label.font = UIFont.ows_dynamicTypeSubheadline + } container.addSubview(label) + label.textColor = UIColor.black.withAlphaComponent(0.9) label.numberOfLines = 0 label.lineBreakMode = .byWordWrapping - label.autoPinEdge(toSuperviewEdge: .top) label.autoPinLeadingToSuperviewMargin() + label.autoPinEdge(toSuperviewEdge: .top) label.autoPinEdge(toSuperviewEdge: .bottom) - label.textColor = UIColor.black.withAlphaComponent(0.9) guard mode == .nag else { label.autoPinTrailingToSuperviewMargin()