Add blocking to conversation settings

pull/228/head
nielsandriesse 5 years ago
parent 42cd30cf23
commit e05a4cd4a7

@ -810,34 +810,19 @@ const CGFloat kIconViewLength = 24;
} }
// Block Conversation section. // Block Conversation section.
/** if (!isNoteToSelf && [self.thread isKindOfClass:TSContactThread.class]) {
* Loki: Original code mainSection.footerTitle = NSLocalizedString(
* ======== @"BLOCK_USER_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of blocking another user.");
if (!isNoteToSelf) {
OWSTableSection *section = [OWSTableSection new];
if (self.thread.isGroupThread) {
section.footerTitle = NSLocalizedString(
@"BLOCK_GROUP_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of blocking a group.");
} else {
section.footerTitle = NSLocalizedString(
@"BLOCK_USER_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of blocking another user.");
}
[section addItem:[OWSTableItem [mainSection addItem:[OWSTableItem
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
OWSConversationSettingsViewController *strongSelf = weakSelf; OWSConversationSettingsViewController *strongSelf = weakSelf;
if (!strongSelf) { if (!strongSelf) {
return [UITableViewCell new]; return [UITableViewCell new];
} }
NSString *cellTitle; NSString *cellTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_BLOCK_THIS_USER",
if (strongSelf.thread.isGroupThread) { @"table cell label in conversation settings");
cellTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_BLOCK_THIS_GROUP",
@"table cell label in conversation settings");
} else {
cellTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_BLOCK_THIS_USER",
@"table cell label in conversation settings");
}
UITableViewCell *cell = [strongSelf UITableViewCell *cell = [strongSelf
disclosureCellWithName:cellTitle disclosureCellWithName:cellTitle
iconName:@"table_ic_block" iconName:@"table_ic_block"
@ -857,10 +842,7 @@ const CGFloat kIconViewLength = 24;
return cell; return cell;
} }
actionBlock:nil]]; actionBlock:nil]];
[contents addSection:section];
} }
* ========
*/
self.contents = contents; self.contents = contents;
} }

@ -291,7 +291,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
contactsManager:(OWSContactsManager *)contactsManager contactsManager:(OWSContactsManager *)contactsManager
completionBlock:(nullable BlockActionCompletionBlock)completionBlock completionBlock:(nullable BlockActionCompletionBlock)completionBlock
{ {
NSString *displayName = [LKUserDisplayNameUtilities getPrivateChatDisplayNameFor:phoneNumber]; NSString *displayName = [LKUserDisplayNameUtilities getPrivateChatDisplayNameFor:phoneNumber] ?: phoneNumber;
[self showUnblockPhoneNumbersActionSheet:@[ phoneNumber ] [self showUnblockPhoneNumbersActionSheet:@[ phoneNumber ]
displayName:displayName displayName:displayName
fromViewController:fromViewController fromViewController:fromViewController

Loading…
Cancel
Save