Enable sending messages with pills

This commit is contained in:
aringenbach
2022-05-02 13:35:35 +02:00
parent 968c2e34c5
commit 8d65cd8a40
17 changed files with 555 additions and 175 deletions
@@ -170,6 +170,11 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey;
*/
@property (nonatomic) NSString *partialTextMessage;
/**
The current attributed text message partially typed in text input (use nil to reset it).
*/
@property (nonatomic) NSAttributedString *attributedPartialTextMessage;
/**
The current thread id for the data source. If provided, data source displays the specified thread, otherwise the whole room messages.
*/
@@ -471,6 +476,8 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey;
success:(void (^)(NSString *))success
failure:(void (^)(NSError *))failure;
- (void)updateEventWithReplaceEvent:(MXEvent*)replaceEvent;
/**
Indicates if replying to the provided event is supported.
Only event of type 'MXEventTypeRoomMessage' are supported for the moment, and for certain msgtype.
@@ -735,6 +742,25 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey;
roomState:(MXRoomState*)roomState
direction:(MXTimelineDirection)direction;
/**
Queue an event in order to process its display later.
@param event the event to process.
@param roomState the state of the room when the event fired.
@param direction the order of the events in the arrays
*/
- (void)queueEventForProcessing:(MXEvent*)event
withRoomState:(MXRoomState*)roomState
direction:(MXTimelineDirection)direction;
/**
Start processing pending events.
@param onComplete a block called (on the main thread) when the processing has been done. Can be nil.
Note this block returns the number of added cells in first and last positions.
*/
- (void)processQueuedEvents:(void (^)(NSUInteger addedHistoryCellNb, NSUInteger addedLiveCellNb))onComplete;
#pragma mark - Bubble collapsing
/**
@@ -31,7 +31,6 @@
#import "MXKAppSettings.h"
#import "MXKSendReplyEventStringLocalizer.h"
#import "MXKSlashCommands.h"
#import "GeneratedInterface-Swift.h"
@@ -991,6 +990,16 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
_room.partialTextMessage = partialTextMessage;
}
- (NSAttributedString *)attributedPartialTextMessage
{
return _room.attributedPartialTextMessage;
}
- (void)setAttributedPartialTextMessage:(NSAttributedString *)attributedPartialTextMessage
{
_room.attributedPartialTextMessage = attributedPartialTextMessage;
}
- (void)refreshEventListeners:(NSArray *)liveEventTypesFilterForMessages
{
// Remove the existing listeners
@@ -2982,13 +2991,6 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
return processingQueue;
}
/**
Queue an event in order to process its display later.
@param event the event to process.
@param roomState the state of the room when the event fired.
@param direction the order of the events in the arrays
*/
- (void)queueEventForProcessing:(MXEvent*)event withRoomState:(MXRoomState*)roomState direction:(MXTimelineDirection)direction
{
if (event.isLocalEvent)
@@ -3166,12 +3168,6 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
return isHighlighted;
}
/**
Start processing pending events.
@param onComplete a block called (on the main thread) when the processing has been done. Can be nil.
Note this block returns the number of added cells in first and last positions.
*/
- (void)processQueuedEvents:(void (^)(NSUInteger addedHistoryCellNb, NSUInteger addedLiveCellNb))onComplete
{
MXWeakify(self);
@@ -1,25 +0,0 @@
/*
Copyright 2018 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import <Foundation/Foundation.h>
#import <MatrixSDK/MXSendReplyEventStringLocalizerProtocol.h>
/**
A `MXKSendReplyEventStringLocalizer` instance represents string localizations used when send reply event to a message in a room.
*/
@interface MXKSendReplyEventStringLocalizer : NSObject<MXSendReplyEventStringLocalizerProtocol>
@end
@@ -1,58 +0,0 @@
/*
Copyright 2018 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "MXKSendReplyEventStringLocalizer.h"
#import "MXKSwiftHeader.h"
@implementation MXKSendReplyEventStringLocalizer
- (NSString *)senderSentAnImage
{
return [VectorL10n messageReplyToSenderSentAnImage];
}
- (NSString *)senderSentAVideo
{
return [VectorL10n messageReplyToSenderSentAVideo];
}
- (NSString *)senderSentAnAudioFile
{
return [VectorL10n messageReplyToSenderSentAnAudioFile];
}
- (NSString *)senderSentAVoiceMessage
{
return [VectorL10n messageReplyToSenderSentAVoiceMessage];
}
- (NSString *)senderSentAFile
{
return [VectorL10n messageReplyToSenderSentAFile];
}
- (NSString *)senderSentTheirLocation
{
return [VectorL10n messageReplyToSenderSentTheirLocation];
}
- (NSString *)messageToReplyToPrefix
{
return [VectorL10n messageReplyToMessageToReplyToPrefix];
}
@end
@@ -0,0 +1,47 @@
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
class MXKSendReplyEventStringLocalizer: NSObject, MXSendReplyEventStringLocalizerProtocol {
func senderSentAnImage() -> String {
return VectorL10n.messageReplyToSenderSentAnImage
}
func senderSentAVideo() -> String {
return VectorL10n.messageReplyToSenderSentAVideo
}
func senderSentAnAudioFile() -> String {
return VectorL10n.messageReplyToSenderSentAnAudioFile
}
func senderSentAVoiceMessage() -> String {
return VectorL10n.messageReplyToSenderSentAVoiceMessage
}
func senderSentAFile() -> String {
return VectorL10n.messageReplyToSenderSentAFile
}
func senderSentTheirLocation() -> String {
return VectorL10n.messageReplyToSenderSentTheirLocation
}
func messageToReplyToPrefix() -> String {
return VectorL10n.messageReplyToMessageToReplyToPrefix
}
}