Add blocking to conversation settings

This commit is contained in:
nielsandriesse 2020-07-21 14:48:04 +10:00
parent 42cd30cf23
commit e05a4cd4a7
2 changed files with 7 additions and 25 deletions

View File

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

View File

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