Add explanation messages to the “block user alert” and the block section of the 1:1 conversation settings view.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-04-10 15:58:34 -04:00
parent 61c865a78d
commit 4e3fbac107
5 changed files with 54 additions and 25 deletions

View File

@ -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_LIST_BLOCK_ALERT_MESSAGE",
@"The message of the 'block user' action sheet.")
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *unblockAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button")

View File

@ -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(@"CONVERSATION_SETTINGS_BLOCK_FOOTER_TITLE",
@"A footer title for the block user option in the conversation settings");
[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 = @[

View File

@ -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<OWSTableItem *> *)items;
+ (OWSTableSection *)sectionWithTitle:(nullable NSString *)title items:(NSArray<OWSTableItem *> *)items;
- (void)addItem:(OWSTableItem *)item;

View File

@ -45,10 +45,10 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSTableSection
+ (OWSTableSection *)sectionWithTitle:(NSString *)title items:(NSArray<OWSTableItem *> *)items
+ (OWSTableSection *)sectionWithTitle:(nullable NSString *)title items:(NSArray<OWSTableItem *> *)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

View File

@ -97,6 +97,9 @@
/* No comment provided by engineer. */
"ATTACHMENT_QUEUED" = "New attachment queued for retrieval.";
/* The message of the 'block user' action sheet. */
"BLOCK_LIST_BLOCK_ALERT_MESSAGE" = "Blocked users will not be able to call you or send you messages.";
/* Button label for the 'block' button */
"BLOCK_LIST_BLOCK_BUTTON" = "Block";
@ -217,6 +220,9 @@
/* title for conversation settings screen */
"CONVERSATION_SETTINGS" = "Conversation Settings";
/* A footer title for the block user option in the conversation settings */
"CONVERSATION_SETTINGS_BLOCK_FOOTER_TITLE" = "Blocked users will not be able to call you or send you messages.";
/* table cell label in conversation settings */
"CONVERSATION_SETTINGS_BLOCK_THIS_USER" = "Block this user";