diff --git a/Signal/src/ViewControllers/MessagesViewController.m b/Signal/src/ViewControllers/MessagesViewController.m index 8602e87bd..8390e6c61 100644 --- a/Signal/src/ViewControllers/MessagesViewController.m +++ b/Signal/src/ViewControllers/MessagesViewController.m @@ -549,16 +549,15 @@ typedef enum : NSUInteger { if ([self isBlockedContactConversation]) { blockStateMessage = NSLocalizedString(@"MESSAGES_VIEW_CONTACT_BLOCKED", @"Indicates that this 1:1 conversation has been blocked."); - } else { + } else if (isGroupConversation) { int blockedGroupMemberCount = [self blockedGroupMemberCount]; if (blockedGroupMemberCount == 1) { - blockStateMessage = [NSString stringWithFormat:NSLocalizedString(@"MESSAGES_VIEW_GROUP_1_MEMBER_BLOCKED_FORMAT", - @"Indicates that a single member of this group has been blocked."), - blockedGroupMemberCount]; + blockStateMessage = NSLocalizedString(@"MESSAGES_VIEW_GROUP_1_MEMBER_BLOCKED", + @"Indicates that a single member of this group has been blocked."); } else if (blockedGroupMemberCount > 1) { blockStateMessage = [NSString stringWithFormat:NSLocalizedString(@"MESSAGES_VIEW_GROUP_N_MEMBERS_BLOCKED_FORMAT", @"Indicates that some members of this group has been blocked. Embeds " - @"{{the number of blocked user in this group}}."), + @"{{the number of blocked users in this group}}."), blockedGroupMemberCount]; } } @@ -570,7 +569,7 @@ typedef enum : NSUInteger { label.textColor = [UIColor whiteColor]; UIView * blockStateIndicator = [UIView new]; - blockStateIndicator.backgroundColor = [UIColor ows_signalBrandBlueColor]; + blockStateIndicator.backgroundColor = [UIColor ows_redColor]; blockStateIndicator.layer.cornerRadius = 2.5f; // Use a shadow to "pop" the indicator above the other views. @@ -605,7 +604,7 @@ typedef enum : NSUInteger { if ([self isBlockedContactConversation]) { // If this a blocked 1:1 conversation, offer to unblock the user. [self showUnblockContactUI:nil]; - } else { + } else if (isGroupConversation) { // If this a group conversation with at least one blocked member, // Show the block list view. int blockedGroupMemberCount = [self blockedGroupMemberCount]; @@ -620,6 +619,16 @@ typedef enum : NSUInteger { { OWSAssert([self.thread isKindOfClass:[TSContactThread class]]); + self.userHasScrolled = NO; + + // To avoid "noisy" animations (hiding the keyboard before showing + // the action sheet, re-showing it after), hide the keyboard before + // showing the "unblock" action sheet. + // + // Unblocking is a rare interaction, so it's okay to leave the keyboard + // hidden. + [self dismissKeyBoard]; + NSString *contactIdentifier = ((TSContactThread *)self.thread).contactIdentifier; [BlockListUIUtils showUnblockPhoneNumberActionSheet:contactIdentifier fromViewController:self @@ -639,9 +648,9 @@ typedef enum : NSUInteger { - (int)blockedGroupMemberCount { - if (![self.thread isKindOfClass:[TSGroupThread class]]) { - return 0; - } + OWSAssert(isGroupConversation); + OWSAssert([self.thread isKindOfClass:[TSGroupThread class]]); + TSGroupThread *groupThread = (TSGroupThread *)self.thread; int blockedMemberCount = 0; NSArray *blockedPhoneNumbers = [_blockingManager blockedPhoneNumbers]; @@ -1018,6 +1027,21 @@ typedef enum : NSUInteger { senderId:(NSString *)senderId senderDisplayName:(NSString *)senderDisplayName date:(NSDate *)date +{ + [self didPressSendButton:button + withMessageText:text + senderId:senderId + senderDisplayName:senderDisplayName + date:date + updateKeyboardState:YES]; +} + +- (void)didPressSendButton:(UIButton *)button + withMessageText:(NSString *)text + senderId:(NSString *)senderId + senderDisplayName:(NSString *)senderDisplayName + date:(NSDate *)date + updateKeyboardState:(BOOL)updateKeyboardState { if ([self isBlockedContactConversation]) { __weak MessagesViewController *weakSelf = self; @@ -1027,7 +1051,8 @@ typedef enum : NSUInteger { withMessageText:text senderId:senderId senderDisplayName:senderDisplayName - date:date]; + date:date + updateKeyboardState:NO]; } }]; return; @@ -1064,7 +1089,10 @@ typedef enum : NSUInteger { [ThreadUtil sendMessageWithText:text inThread:self.thread messageSender:self.messageSender]; - [self toggleDefaultKeyboard]; + if (updateKeyboardState) + { + [self toggleDefaultKeyboard]; + } [self finishSendingMessage]; } } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 022b4f660..edcda7c21 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -530,13 +530,13 @@ "MESSAGE_STATUS_UPLOADING" = "Uploading..."; /* Indicates that this 1:1 conversation has been blocked. */ -"MESSAGES_VIEW_CONTACT_BLOCKED" = "This User is Blocked"; +"MESSAGES_VIEW_CONTACT_BLOCKED" = "You Blocked this User"; /* Indicates that a single member of this group has been blocked. */ -"MESSAGES_VIEW_GROUP_1_MEMBER_BLOCKED_FORMAT" = "1 Blocked Member of this Group"; +"MESSAGES_VIEW_GROUP_1_MEMBER_BLOCKED" = "You Blocked 1 Member of this Group"; /* Indicates that some members of this group has been blocked. Embeds {{the number of blocked user in this group}}. */ -"MESSAGES_VIEW_GROUP_N_MEMBERS_BLOCKED_FORMAT" = "%d Blocked Members of this Group"; +"MESSAGES_VIEW_GROUP_N_MEMBERS_BLOCKED_FORMAT" = "You Blocked %d Members of this Group"; /* The subtitle for the messages view title indicates that the title can be tapped to access settings for this conversation. */ "MESSAGES_VIEW_TITLE_SUBTITLE" = "Tap here for settings";