mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Ensure that mention behavior is consistent cross-platform
This commit is contained in:
parent
8264191ead
commit
966748ed1b
2 changed files with 2 additions and 4 deletions
|
@ -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<NSString *> *knownUserIDs = LKAPI.userIDCache[thread.uniqueId];
|
||||
NSMutableArray<NSValue *> *mentions = [NSMutableArray new];
|
||||
|
|
|
@ -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<NSString *> *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 {
|
||||
|
|
Loading…
Reference in a new issue