group blocking v. conversation view
This commit is contained in:
parent
eadb04efcc
commit
b1da5e93d9
|
@ -865,10 +865,14 @@ typedef enum : NSUInteger {
|
|||
}
|
||||
|
||||
NSString *blockStateMessage = nil;
|
||||
// FIXME - group blocking
|
||||
if ([self isBlockedContactConversation]) {
|
||||
blockStateMessage = NSLocalizedString(
|
||||
@"MESSAGES_VIEW_CONTACT_BLOCKED", @"Indicates that this 1:1 conversation has been blocked.");
|
||||
if ([self isBlockedConversation]) {
|
||||
if (self.isGroupConversation) {
|
||||
blockStateMessage = NSLocalizedString(
|
||||
@"MESSAGES_VIEW_GROUP_BLOCKED", @"Indicates that this group conversation has been blocked.");
|
||||
} else {
|
||||
blockStateMessage = NSLocalizedString(
|
||||
@"MESSAGES_VIEW_CONTACT_BLOCKED", @"Indicates that this 1:1 conversation has been blocked.");
|
||||
}
|
||||
} else if (self.isGroupConversation) {
|
||||
int blockedGroupMemberCount = [self blockedGroupMemberCount];
|
||||
if (blockedGroupMemberCount == 1) {
|
||||
|
@ -965,9 +969,9 @@ typedef enum : NSUInteger {
|
|||
return;
|
||||
}
|
||||
|
||||
if ([self isBlockedContactConversation]) {
|
||||
// If this a blocked 1:1 conversation, offer to unblock the user.
|
||||
[self showUnblockContactUI:nil];
|
||||
if ([self isBlockedConversation]) {
|
||||
// If this a blocked conversation, offer to unblock.
|
||||
[self showUnblockConversationUI:nil];
|
||||
} else if (self.isGroupConversation) {
|
||||
// If this a group conversation with at least one blocked member,
|
||||
// Show the block list view.
|
||||
|
@ -1055,10 +1059,8 @@ typedef enum : NSUInteger {
|
|||
}
|
||||
}
|
||||
|
||||
- (void)showUnblockContactUI:(nullable BlockActionCompletionBlock)completionBlock
|
||||
- (void)showUnblockConversationUI:(nullable BlockActionCompletionBlock)completionBlock
|
||||
{
|
||||
OWSAssert([self.thread isKindOfClass:[TSContactThread class]]);
|
||||
|
||||
self.userHasScrolled = NO;
|
||||
|
||||
// To avoid "noisy" animations (hiding the keyboard before showing
|
||||
|
@ -1069,21 +1071,16 @@ typedef enum : NSUInteger {
|
|||
// hidden.
|
||||
[self dismissKeyBoard];
|
||||
|
||||
NSString *contactIdentifier = ((TSContactThread *)self.thread).contactIdentifier;
|
||||
[BlockListUIUtils showUnblockPhoneNumberActionSheet:contactIdentifier
|
||||
fromViewController:self
|
||||
blockingManager:_blockingManager
|
||||
contactsManager:_contactsManager
|
||||
completionBlock:completionBlock];
|
||||
[BlockListUIUtils showUnblockThreadActionSheet:self.thread
|
||||
fromViewController:self
|
||||
blockingManager:self.blockingManager
|
||||
contactsManager:self.contactsManager
|
||||
completionBlock:completionBlock];
|
||||
}
|
||||
|
||||
- (BOOL)isBlockedContactConversation
|
||||
- (BOOL)isBlockedConversation
|
||||
{
|
||||
if (![self.thread isKindOfClass:[TSContactThread class]]) {
|
||||
return NO;
|
||||
}
|
||||
NSString *contactIdentifier = ((TSContactThread *)self.thread).contactIdentifier;
|
||||
return [[_blockingManager blockedPhoneNumbers] containsObject:contactIdentifier];
|
||||
return [self.blockingManager isThreadBlocked:self.thread];
|
||||
}
|
||||
|
||||
- (int)blockedGroupMemberCount
|
||||
|
@ -1511,8 +1508,8 @@ typedef enum : NSUInteger {
|
|||
}
|
||||
|
||||
__weak ConversationViewController *weakSelf = self;
|
||||
if ([self isBlockedContactConversation]) {
|
||||
[self showUnblockContactUI:^(BOOL isBlocked) {
|
||||
if ([self isBlockedConversation]) {
|
||||
[self showUnblockConversationUI:^(BOOL isBlocked) {
|
||||
if (!isBlocked) {
|
||||
[weakSelf callWithVideo:isVideo];
|
||||
}
|
||||
|
@ -3740,8 +3737,8 @@ typedef enum : NSUInteger {
|
|||
[self dismissKeyBoard];
|
||||
|
||||
__weak ConversationViewController *weakSelf = self;
|
||||
if ([self isBlockedContactConversation]) {
|
||||
[self showUnblockContactUI:^(BOOL isBlocked) {
|
||||
if ([self isBlockedConversation]) {
|
||||
[self showUnblockConversationUI:^(BOOL isBlocked) {
|
||||
if (!isBlocked) {
|
||||
[weakSelf attachmentButtonPressed];
|
||||
}
|
||||
|
@ -4097,8 +4094,8 @@ typedef enum : NSUInteger {
|
|||
|
||||
DispatchMainThreadSafe(^{
|
||||
__weak ConversationViewController *weakSelf = self;
|
||||
if ([self isBlockedContactConversation]) {
|
||||
[self showUnblockContactUI:^(BOOL isBlocked) {
|
||||
if ([self isBlockedConversation]) {
|
||||
[self showUnblockConversationUI:^(BOOL isBlocked) {
|
||||
if (!isBlocked) {
|
||||
[weakSelf tryToSendAttachmentIfApproved:attachment];
|
||||
}
|
||||
|
@ -4407,8 +4404,8 @@ typedef enum : NSUInteger {
|
|||
{
|
||||
|
||||
__weak ConversationViewController *weakSelf = self;
|
||||
if ([self isBlockedContactConversation]) {
|
||||
[self showUnblockContactUI:^(BOOL isBlocked) {
|
||||
if ([self isBlockedConversation]) {
|
||||
[self showUnblockConversationUI:^(BOOL isBlocked) {
|
||||
if (!isBlocked) {
|
||||
[weakSelf tryToSendTextMessage:text updateKeyboardState:NO];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue