Merge branch 'charlesmchen/blockWarningMessages'

This commit is contained in:
Matthew Chen 2017-04-11 18:04:54 -04:00
commit f36316c609
6 changed files with 54 additions and 30 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_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")

View File

@ -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;
}
}

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(@"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 = @[

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.";
/* 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.";