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

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 61c865a78d
commit 4e3fbac107

@ -99,7 +99,10 @@ typedef void (^BlockAlertCompletionBlock)();
[self formatDisplayNameForAlertTitle:displayName]]; [self formatDisplayNameForAlertTitle:displayName]];
UIAlertController *actionSheetController = 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 UIAlertAction *unblockAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button") actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button")

@ -194,6 +194,8 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
__weak OWSConversationSettingsTableViewController *weakSelf = self; __weak OWSConversationSettingsTableViewController *weakSelf = self;
// First section.
NSMutableArray *firstSectionItems = [NSMutableArray new]; NSMutableArray *firstSectionItems = [NSMutableArray new];
if (!self.isGroupThread && self.thread.hasSafetyNumbers) { if (!self.isGroupThread && self.thread.hasSafetyNumbers) {
[firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ [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) { if (!self.isGroupThread) {
BOOL isBlocked = [[_blockingManager blockedPhoneNumbers] containsObject:self.signalId]; BOOL isBlocked = [[_blockingManager blockedPhoneNumbers] containsObject:self.signalId];
[firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ OWSTableItem *item = [OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
cell.textLabel.text = NSLocalizedString( cell.textLabel.text = NSLocalizedString(
@"CONVERSATION_SETTINGS_BLOCK_THIS_USER", @"table cell label in conversation settings"); @"CONVERSATION_SETTINGS_BLOCK_THIS_USER", @"table cell label in conversation settings");
@ -234,26 +256,17 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
cell.accessoryView = blockUserSwitch; cell.accessoryView = blockUserSwitch;
return cell; return cell;
} }
actionBlock:nil]]; actionBlock:nil];
} OWSTableSection *section = [OWSTableSection sectionWithTitle:nil
items:@[
[firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{ item,
weakSelf.toggleDisappearingMessagesCell.selectionStyle = UITableViewCellSelectionStyleNone; ]];
return weakSelf.toggleDisappearingMessagesCell; section.footerTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_BLOCK_FOOTER_TITLE",
@"A footer title for the block user option in the conversation settings");
[contents addSection:section];
} }
customRowHeight:108.f
actionBlock:nil]];
if (self.disappearingMessagesSwitch.isOn) { // Third section.
[firstSectionItems addObject:[OWSTableItem itemWithCustomCellBlock:^{
weakSelf.disappearingMessagesDurationCell.selectionStyle = UITableViewCellSelectionStyleNone;
return weakSelf.disappearingMessagesDurationCell;
}
customRowHeight:76.f
actionBlock:nil]];
}
[contents addSection:[OWSTableSection sectionWithTitle:nil items:firstSectionItems]];
if (self.isGroupThread) { if (self.isGroupThread) {
NSArray *groupItems = @[ NSArray *groupItems = @[

@ -21,9 +21,10 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSTableSection : NSObject @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; - (void)addItem:(OWSTableItem *)item;

@ -45,10 +45,10 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSTableSection @implementation OWSTableSection
+ (OWSTableSection *)sectionWithTitle:(NSString *)title items:(NSArray<OWSTableItem *> *)items + (OWSTableSection *)sectionWithTitle:(nullable NSString *)title items:(NSArray<OWSTableItem *> *)items
{ {
OWSTableSection *section = [OWSTableSection new]; OWSTableSection *section = [OWSTableSection new];
section.title = title; section.headerTitle = title;
section.items = [items mutableCopy]; section.items = [items mutableCopy];
return section; return section;
} }
@ -224,7 +224,13 @@ NSString * const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)sectionIndex - (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)sectionIndex
{ {
OWSTableSection *section = [self sectionForIndex: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 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

@ -97,6 +97,9 @@
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"ATTACHMENT_QUEUED" = "New attachment queued for retrieval."; "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 */ /* Button label for the 'block' button */
"BLOCK_LIST_BLOCK_BUTTON" = "Block"; "BLOCK_LIST_BLOCK_BUTTON" = "Block";
@ -217,6 +220,9 @@
/* title for conversation settings screen */ /* title for conversation settings screen */
"CONVERSATION_SETTINGS" = "Conversation Settings"; "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 */ /* table cell label in conversation settings */
"CONVERSATION_SETTINGS_BLOCK_THIS_USER" = "Block this user"; "CONVERSATION_SETTINGS_BLOCK_THIS_USER" = "Block this user";

Loading…
Cancel
Save