From 966748ed1ba46be95800a2cc48679dca8044ce8c Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 10 Oct 2019 16:30:12 +1100 Subject: [PATCH] Ensure that mention behavior is consistent cross-platform --- .../ConversationView/Cells/OWSMessageBubbleView.m | 2 +- .../ConversationView/ConversationViewController.m | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 688428819..c3b400513 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -709,7 +709,7 @@ NS_ASSUME_NONNULL_BEGIN NSString *text = displayableText.displayText; NSError *error1; - NSRegularExpression *regex1 = [[NSRegularExpression alloc] initWithPattern:@"@\\w*" options:0 error:&error1]; + NSRegularExpression *regex1 = [[NSRegularExpression alloc] initWithPattern:@"@[0-9a-fA-F]*" options:0 error:&error1]; OWSAssertDebug(error1 == nil); NSSet *knownUserIDs = LKAPI.userIDCache[thread.uniqueId]; NSMutableArray *mentions = [NSMutableArray new]; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 4e98858b2..c5cc8e79c 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3773,13 +3773,11 @@ typedef enum : NSUInteger { [self.typingIndicators didStartTypingOutgoingInputInThread:self.thread]; NSUInteger currentEndIndex = textView.text.length - 1; unichar lastCharacter = [textView.text characterAtIndex:currentEndIndex]; - NSMutableCharacterSet *allowedCharacters = NSMutableCharacterSet.lowercaseLetterCharacterSet; - [allowedCharacters formUnionWithCharacterSet:NSCharacterSet.uppercaseLetterCharacterSet]; if (lastCharacter == '@') { NSArray *userIDs = [LKAPI getUserIDsFor:@"" in:self.thread.uniqueId]; self.mentionStartIndex = (NSInteger)currentEndIndex + 1; [self.inputToolbar showUserSelectionViewFor:userIDs in:self.thread]; - } else if (![allowedCharacters characterIsMember:lastCharacter]) { + } else if ([NSCharacterSet.whitespaceAndNewlineCharacterSet characterIsMember:lastCharacter]) { self.mentionStartIndex = -1; [self.inputToolbar hideUserSelectionView]; } else {