Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 99a1b4e9f4
commit 7273e6faa5

@ -549,16 +549,15 @@ typedef enum : NSUInteger {
if ([self isBlockedContactConversation]) { if ([self isBlockedContactConversation]) {
blockStateMessage = NSLocalizedString(@"MESSAGES_VIEW_CONTACT_BLOCKED", blockStateMessage = NSLocalizedString(@"MESSAGES_VIEW_CONTACT_BLOCKED",
@"Indicates that this 1:1 conversation has been blocked."); @"Indicates that this 1:1 conversation has been blocked.");
} else { } else if (isGroupConversation) {
int blockedGroupMemberCount = [self blockedGroupMemberCount]; int blockedGroupMemberCount = [self blockedGroupMemberCount];
if (blockedGroupMemberCount == 1) { if (blockedGroupMemberCount == 1) {
blockStateMessage = [NSString stringWithFormat:NSLocalizedString(@"MESSAGES_VIEW_GROUP_1_MEMBER_BLOCKED_FORMAT", blockStateMessage = NSLocalizedString(@"MESSAGES_VIEW_GROUP_1_MEMBER_BLOCKED",
@"Indicates that a single member of this group has been blocked."), @"Indicates that a single member of this group has been blocked.");
blockedGroupMemberCount];
} else if (blockedGroupMemberCount > 1) { } else if (blockedGroupMemberCount > 1) {
blockStateMessage = [NSString stringWithFormat:NSLocalizedString(@"MESSAGES_VIEW_GROUP_N_MEMBERS_BLOCKED_FORMAT", blockStateMessage = [NSString stringWithFormat:NSLocalizedString(@"MESSAGES_VIEW_GROUP_N_MEMBERS_BLOCKED_FORMAT",
@"Indicates that some members of this group has been blocked. Embeds " @"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]; blockedGroupMemberCount];
} }
} }
@ -570,7 +569,7 @@ typedef enum : NSUInteger {
label.textColor = [UIColor whiteColor]; label.textColor = [UIColor whiteColor];
UIView * blockStateIndicator = [UIView new]; UIView * blockStateIndicator = [UIView new];
blockStateIndicator.backgroundColor = [UIColor ows_signalBrandBlueColor]; blockStateIndicator.backgroundColor = [UIColor ows_redColor];
blockStateIndicator.layer.cornerRadius = 2.5f; blockStateIndicator.layer.cornerRadius = 2.5f;
// Use a shadow to "pop" the indicator above the other views. // Use a shadow to "pop" the indicator above the other views.
@ -605,7 +604,7 @@ typedef enum : NSUInteger {
if ([self isBlockedContactConversation]) { if ([self isBlockedContactConversation]) {
// If this a blocked 1:1 conversation, offer to unblock the user. // If this a blocked 1:1 conversation, offer to unblock the user.
[self showUnblockContactUI:nil]; [self showUnblockContactUI:nil];
} else { } else if (isGroupConversation) {
// If this a group conversation with at least one blocked member, // If this a group conversation with at least one blocked member,
// Show the block list view. // Show the block list view.
int blockedGroupMemberCount = [self blockedGroupMemberCount]; int blockedGroupMemberCount = [self blockedGroupMemberCount];
@ -620,6 +619,16 @@ typedef enum : NSUInteger {
{ {
OWSAssert([self.thread isKindOfClass:[TSContactThread class]]); 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; NSString *contactIdentifier = ((TSContactThread *)self.thread).contactIdentifier;
[BlockListUIUtils showUnblockPhoneNumberActionSheet:contactIdentifier [BlockListUIUtils showUnblockPhoneNumberActionSheet:contactIdentifier
fromViewController:self fromViewController:self
@ -639,9 +648,9 @@ typedef enum : NSUInteger {
- (int)blockedGroupMemberCount - (int)blockedGroupMemberCount
{ {
if (![self.thread isKindOfClass:[TSGroupThread class]]) { OWSAssert(isGroupConversation);
return 0; OWSAssert([self.thread isKindOfClass:[TSGroupThread class]]);
}
TSGroupThread *groupThread = (TSGroupThread *)self.thread; TSGroupThread *groupThread = (TSGroupThread *)self.thread;
int blockedMemberCount = 0; int blockedMemberCount = 0;
NSArray<NSString *> *blockedPhoneNumbers = [_blockingManager blockedPhoneNumbers]; NSArray<NSString *> *blockedPhoneNumbers = [_blockingManager blockedPhoneNumbers];
@ -1018,6 +1027,21 @@ typedef enum : NSUInteger {
senderId:(NSString *)senderId senderId:(NSString *)senderId
senderDisplayName:(NSString *)senderDisplayName senderDisplayName:(NSString *)senderDisplayName
date:(NSDate *)date 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]) { if ([self isBlockedContactConversation]) {
__weak MessagesViewController *weakSelf = self; __weak MessagesViewController *weakSelf = self;
@ -1027,7 +1051,8 @@ typedef enum : NSUInteger {
withMessageText:text withMessageText:text
senderId:senderId senderId:senderId
senderDisplayName:senderDisplayName senderDisplayName:senderDisplayName
date:date]; date:date
updateKeyboardState:NO];
} }
}]; }];
return; return;
@ -1064,7 +1089,10 @@ typedef enum : NSUInteger {
[ThreadUtil sendMessageWithText:text [ThreadUtil sendMessageWithText:text
inThread:self.thread inThread:self.thread
messageSender:self.messageSender]; messageSender:self.messageSender];
[self toggleDefaultKeyboard]; if (updateKeyboardState)
{
[self toggleDefaultKeyboard];
}
[self finishSendingMessage]; [self finishSendingMessage];
} }
} }

@ -530,13 +530,13 @@
"MESSAGE_STATUS_UPLOADING" = "Uploading..."; "MESSAGE_STATUS_UPLOADING" = "Uploading...";
/* Indicates that this 1:1 conversation has been blocked. */ /* 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. */ /* 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}}. */ /* 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. */ /* 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"; "MESSAGES_VIEW_TITLE_SUBTITLE" = "Tap here for settings";

Loading…
Cancel
Save