Merge pull request #6039 from vector-im/aringenbach/3526_user_pills

Add mention pills to timeline & composer
This commit is contained in:
aringenbach
2022-05-12 11:05:22 +02:00
committed by GitHub
35 changed files with 1576 additions and 345 deletions
@@ -15,7 +15,7 @@
*/
#import "MXKMessageTextView.h"
#import "UITextView+MatrixKit.h"
#import "GeneratedInterface-Swift.h"
@interface MXKMessageTextView()
@@ -51,7 +51,7 @@
return NO;
}
return [self isThereALinkNearPoint:point];
return [self isThereALinkNearLocation:point];
}
@end
@@ -269,6 +269,11 @@ typedef enum : NSUInteger
*/
- (IBAction)onTouchUpInside:(UIButton*)button;
/**
Send message currently displayed inside toolbar's ` UITextView`.
*/
- (void)sendCurrentMessage;
/**
Handle image attachment
Save the image in user's photos library when 'isPhotoLibraryAsset' flag is NO and auto saving is enabled.
@@ -277,22 +277,27 @@
}
else if (button == self.rightInputToolbarButton && self.textMessage.length)
{
// This forces an autocorrect event to happen when "Send" is pressed, which is necessary to accept a pending correction on send
self.textMessage = [NSString stringWithFormat:@"%@ ", self.textMessage];
self.textMessage = [self.textMessage substringToIndex:[self.textMessage length]-1];
[self sendCurrentMessage];
}
}
NSString *message = self.textMessage;
// Reset message, disable view animation during the update to prevent placeholder distorsion.
[UIView setAnimationsEnabled:NO];
self.textMessage = nil;
[UIView setAnimationsEnabled:YES];
// Send button has been pressed
if (message.length && [self.delegate respondsToSelector:@selector(roomInputToolbarView:sendTextMessage:)])
{
[self.delegate roomInputToolbarView:self sendTextMessage:message];
}
- (void)sendCurrentMessage
{
// This forces an autocorrect event to happen when "Send" is pressed, which is necessary to accept a pending correction on send
self.textMessage = [NSString stringWithFormat:@"%@ ", self.textMessage];
self.textMessage = [self.textMessage substringToIndex:[self.textMessage length]-1];
NSString *message = self.textMessage;
// Reset message, disable view animation during the update to prevent placeholder distorsion.
[UIView setAnimationsEnabled:NO];
self.textMessage = nil;
[UIView setAnimationsEnabled:YES];
// Send button has been pressed
if (message.length && [self.delegate respondsToSelector:@selector(roomInputToolbarView:sendTextMessage:)])
{
[self.delegate roomInputToolbarView:self sendTextMessage:message];
}
}