diff --git a/Signal/src/ViewControllers/BlockListUIUtils.m b/Signal/src/ViewControllers/BlockListUIUtils.m index 06e4d26bf..d70186627 100644 --- a/Signal/src/ViewControllers/BlockListUIUtils.m +++ b/Signal/src/ViewControllers/BlockListUIUtils.m @@ -99,7 +99,10 @@ typedef void (^BlockAlertCompletionBlock)(); [self formatDisplayNameForAlertTitle:displayName]]; UIAlertController *actionSheetController = - [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + [UIAlertController alertControllerWithTitle:title + message:NSLocalizedString(@"BLOCK_BEHAVIOR_EXPLANATION", + @"An explanation of the consequences of blocking another user.") + preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *unblockAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button") diff --git a/Signal/src/ViewControllers/BlockListViewController.m b/Signal/src/ViewControllers/BlockListViewController.m index f9e6b10d0..996306d6c 100644 --- a/Signal/src/ViewControllers/BlockListViewController.m +++ b/Signal/src/ViewControllers/BlockListViewController.m @@ -100,8 +100,9 @@ typedef NS_ENUM(NSInteger, BlockListViewControllerSection) { { switch (section) { case BlockListViewControllerSection_Add: - return NSLocalizedString(@"SETTINGS_BLOCK_LIST_FOOTER_TITLE", @"A footer title for the block list table."); - default: + return NSLocalizedString(@"BLOCK_BEHAVIOR_EXPLANATION", + @"An explanation of the consequences of blocking another user."); + default: return nil; } } diff --git a/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m b/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m index 4e20836da..5497a2e85 100644 --- a/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m +++ b/Signal/src/ViewControllers/OWSConversationSettingsTableViewController.m @@ -194,6 +194,8 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM __weak OWSConversationSettingsTableViewController *weakSelf = self; + // First section. + NSMutableArray *firstSectionItems = [NSMutableArray new]; if (!self.isGroupThread && self.thread.hasSafetyNumbers) { [firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ @@ -209,10 +211,30 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM }]]; } + [firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ + weakSelf.toggleDisappearingMessagesCell.selectionStyle = UITableViewCellSelectionStyleNone; + return weakSelf.toggleDisappearingMessagesCell; + } + customRowHeight:108.f + actionBlock:nil]]; + + if (self.disappearingMessagesSwitch.isOn) { + [firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ + weakSelf.disappearingMessagesDurationCell.selectionStyle = UITableViewCellSelectionStyleNone; + return weakSelf.disappearingMessagesDurationCell; + } + customRowHeight:76.f + actionBlock:nil]]; + } + + [contents addSection:[OWSTableSection sectionWithTitle:nil items:firstSectionItems]]; + + // Second section. + if (!self.isGroupThread) { BOOL isBlocked = [[_blockingManager blockedPhoneNumbers] containsObject:self.signalId]; - [firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ + OWSTableItem *item = [OWSTableItem itemWithCustomCellBlock:^{ UITableViewCell *cell = [UITableViewCell new]; cell.textLabel.text = NSLocalizedString( @"CONVERSATION_SETTINGS_BLOCK_THIS_USER", @"table cell label in conversation settings"); @@ -234,26 +256,17 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM cell.accessoryView = blockUserSwitch; return cell; } - actionBlock:nil]]; + actionBlock:nil]; + OWSTableSection *section = [OWSTableSection sectionWithTitle:nil + items:@[ + item, + ]]; + section.footerTitle = NSLocalizedString(@"BLOCK_BEHAVIOR_EXPLANATION", + @"An explanation of the consequences of blocking another user."); + [contents addSection:section]; } - [firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ - weakSelf.toggleDisappearingMessagesCell.selectionStyle = UITableViewCellSelectionStyleNone; - return weakSelf.toggleDisappearingMessagesCell; - } - customRowHeight:108.f - actionBlock:nil]]; - - if (self.disappearingMessagesSwitch.isOn) { - [firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ - weakSelf.disappearingMessagesDurationCell.selectionStyle = UITableViewCellSelectionStyleNone; - return weakSelf.disappearingMessagesDurationCell; - } - customRowHeight:76.f - actionBlock:nil]]; - } - - [contents addSection:[OWSTableSection sectionWithTitle:nil items:firstSectionItems]]; + // Third section. if (self.isGroupThread) { NSArray *groupItems = @[ diff --git a/Signal/src/ViewControllers/OWSTableViewController.h b/Signal/src/ViewControllers/OWSTableViewController.h index 8685b38ae..005f18c41 100644 --- a/Signal/src/ViewControllers/OWSTableViewController.h +++ b/Signal/src/ViewControllers/OWSTableViewController.h @@ -21,9 +21,10 @@ NS_ASSUME_NONNULL_BEGIN @interface OWSTableSection : NSObject -@property (nonatomic, nullable) NSString *title; +@property (nonatomic, nullable) NSString *headerTitle; +@property (nonatomic, nullable) NSString *footerTitle; -+ (OWSTableSection *)sectionWithTitle:(NSString *)title items:(NSArray *)items; ++ (OWSTableSection *)sectionWithTitle:(nullable NSString *)title items:(NSArray *)items; - (void)addItem:(OWSTableItem *)item; diff --git a/Signal/src/ViewControllers/OWSTableViewController.m b/Signal/src/ViewControllers/OWSTableViewController.m index 1d131d9e5..5e6ac5986 100644 --- a/Signal/src/ViewControllers/OWSTableViewController.m +++ b/Signal/src/ViewControllers/OWSTableViewController.m @@ -45,10 +45,10 @@ NS_ASSUME_NONNULL_BEGIN @implementation OWSTableSection -+ (OWSTableSection *)sectionWithTitle:(NSString *)title items:(NSArray *)items ++ (OWSTableSection *)sectionWithTitle:(nullable NSString *)title items:(NSArray *)items { OWSTableSection *section = [OWSTableSection new]; - section.title = title; + section.headerTitle = title; section.items = [items mutableCopy]; return section; } @@ -224,7 +224,13 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; - (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)sectionIndex { OWSTableSection *section = [self sectionForIndex:sectionIndex]; - return section.title; + return section.headerTitle; +} + +- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)sectionIndex +{ + OWSTableSection *section = [self sectionForIndex:sectionIndex]; + return section.footerTitle; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 820e24ff0..26899b7e5 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -97,6 +97,9 @@ /* No comment provided by engineer. */ "ATTACHMENT_QUEUED" = "New attachment queued for retrieval."; +/* An explanation of the consequences of blocking another user. */ +"BLOCK_BEHAVIOR_EXPLANATION" = "Blocked users will not be able to call you or send you messages."; + /* Button label for the 'block' button */ "BLOCK_LIST_BLOCK_BUTTON" = "Block"; @@ -883,9 +886,6 @@ /* A label for the 'add phone number' button in the block list table. */ "SETTINGS_BLOCK_LIST_ADD_BUTTON" = "Add…"; -/* A footer title for the block list table. */ -"SETTINGS_BLOCK_LIST_FOOTER_TITLE" = "Blocked users will not be able to call you or send you messages."; - /* A label that indicates the user has no Signal contacts. */ "SETTINGS_BLOCK_LIST_NO_CONTACTS" = "You have no contacts on Signal.";