mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
Merge branch 'develop' into ismail/5068_start_thread
This commit is contained in:
@@ -33,7 +33,6 @@ typedef enum : NSUInteger {
|
||||
MXKAttachmentTypeAudio,
|
||||
MXKAttachmentTypeVoiceMessage,
|
||||
MXKAttachmentTypeVideo,
|
||||
MXKAttachmentTypeLocation,
|
||||
MXKAttachmentTypeFile,
|
||||
MXKAttachmentTypeSticker
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ NSString *const kMXKAttachmentFileNameBase = @"attatchment";
|
||||
else
|
||||
{
|
||||
// Note: mxEvent.eventType is supposed to be MXEventTypeRoomMessage here.
|
||||
NSString *msgtype = eventContent[@"msgtype"];
|
||||
NSString *msgtype = eventContent[kMXMessageTypeKey];
|
||||
if ([msgtype isEqualToString:kMXMessageTypeImage])
|
||||
{
|
||||
_type = MXKAttachmentTypeImage;
|
||||
@@ -109,12 +109,6 @@ NSString *const kMXKAttachmentFileNameBase = @"attatchment";
|
||||
_type = MXKAttachmentTypeVideo;
|
||||
MXJSONModelSetDictionary(_thumbnailInfo, eventContent[@"info"][@"thumbnail_info"]);
|
||||
}
|
||||
else if ([msgtype isEqualToString:kMXMessageTypeLocation])
|
||||
{
|
||||
// Not supported yet
|
||||
// _type = MXKAttachmentTypeLocation;
|
||||
return nil;
|
||||
}
|
||||
else if ([msgtype isEqualToString:kMXMessageTypeFile])
|
||||
{
|
||||
_type = MXKAttachmentTypeFile;
|
||||
@@ -125,7 +119,7 @@ NSString *const kMXKAttachmentFileNameBase = @"attatchment";
|
||||
}
|
||||
}
|
||||
|
||||
MXJSONModelSetString(_originalFileName, eventContent[@"body"]);
|
||||
MXJSONModelSetString(_originalFileName, eventContent[kMXMessageBodyKey]);
|
||||
MXJSONModelSetDictionary(_contentInfo, eventContent[@"info"]);
|
||||
MXJSONModelSetMXJSONModel(contentFile, MXEncryptedContentFile, eventContent[@"file"]);
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ static NSAttributedString *messageSeparator = nil;
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add all components of the provided message
|
||||
for (MXKRoomBubbleComponent* component in cellData.bubbleComponents)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *messageType = self.event.content[@"msgtype"];
|
||||
NSString *messageType = self.event.content[kMXMessageTypeKey];
|
||||
|
||||
if (!messageType || !([messageType isEqualToString:kMXMessageTypeText] || [messageType isEqualToString:kMXMessageTypeNotice] || [messageType isEqualToString:kMXMessageTypeEmote]))
|
||||
{
|
||||
|
||||
@@ -605,6 +605,25 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey;
|
||||
success:(void (^)(NSString *eventId))success
|
||||
failure:(void (^)(NSError *error))failure;
|
||||
|
||||
/**
|
||||
Send a location message to a room.
|
||||
|
||||
While sending, a fake event will be echoed in the messages list.
|
||||
Once complete, this local echo will be replaced by the event saved by the homeserver.
|
||||
|
||||
@param latitude the location's latitude
|
||||
@param longitude the location's longitude
|
||||
@param description an optional description
|
||||
@param success A block object called when the operation succeeds. It returns
|
||||
the event id of the event generated on the homeserver
|
||||
@param failure A block object called when the operation fails.
|
||||
*/
|
||||
- (void)sendLocationWithLatitude:(double)latitude
|
||||
longitude:(double)longitude
|
||||
description:(NSString *)description
|
||||
success:(void (^)(NSString *))success
|
||||
failure:(void (^)(NSError *))failure;
|
||||
|
||||
/**
|
||||
Send a generic non state event to a room.
|
||||
|
||||
|
||||
@@ -1952,6 +1952,29 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sendLocationWithLatitude:(double)latitude
|
||||
longitude:(double)longitude
|
||||
description:(NSString *)description
|
||||
success:(void (^)(NSString *))success
|
||||
failure:(void (^)(NSError *))failure
|
||||
{
|
||||
__block MXEvent *localEchoEvent = nil;
|
||||
|
||||
// Make the request to the homeserver
|
||||
[_room sendLocationWithLatitude:latitude
|
||||
longitude:longitude
|
||||
description:description
|
||||
localEcho:&localEchoEvent
|
||||
success:success failure:failure];
|
||||
|
||||
if (localEchoEvent)
|
||||
{
|
||||
// Make the data source digest this fake local echo message
|
||||
[self queueEventForProcessing:localEchoEvent withRoomState:self.roomState direction:MXTimelineDirectionForwards];
|
||||
[self processQueuedEvents:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sendEventOfType:(MXEventTypeString)eventTypeString content:(NSDictionary<NSString*, id>*)msgContent success:(void (^)(NSString *eventId))success failure:(void (^)(NSError *error))failure
|
||||
{
|
||||
__block MXEvent *localEchoEvent = nil;
|
||||
@@ -1989,7 +2012,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
else if ([event.type isEqualToString:kMXEventTypeStringRoomMessage])
|
||||
{
|
||||
// And retry the send the message according to its type
|
||||
NSString *msgType = event.content[@"msgtype"];
|
||||
NSString *msgType = event.content[kMXMessageTypeKey];
|
||||
if ([msgType isEqualToString:kMXMessageTypeText] || [msgType isEqualToString:kMXMessageTypeEmote])
|
||||
{
|
||||
// Resend the Matrix event by reusing the existing echo
|
||||
@@ -2750,7 +2773,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *messageType = event.content[@"msgtype"];
|
||||
NSString *messageType = event.content[kMXMessageTypeKey];
|
||||
if (messageType == nil || [messageType isEqualToString:@"m.bad.encrypted"]) {
|
||||
return NO;
|
||||
}
|
||||
@@ -3948,7 +3971,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
|
||||
if ([self canPerformActionOnEvent:event])
|
||||
{
|
||||
NSString *messageType = event.content[@"msgtype"];
|
||||
NSString *messageType = event.content[kMXMessageTypeKey];
|
||||
|
||||
if ([messageType isEqualToString:kMXMessageTypeKeyVerificationRequest])
|
||||
{
|
||||
@@ -3991,7 +4014,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
{
|
||||
MXEvent *event = [self eventWithEventId:eventId];
|
||||
BOOL isRoomMessage = event.eventType == MXEventTypeRoomMessage;
|
||||
NSString *messageType = event.content[@"msgtype"];
|
||||
NSString *messageType = event.content[kMXMessageTypeKey];
|
||||
|
||||
return isRoomMessage
|
||||
&& ([messageType isEqualToString:kMXMessageTypeText] || [messageType isEqualToString:kMXMessageTypeEmote])
|
||||
@@ -4012,7 +4035,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
}
|
||||
else
|
||||
{
|
||||
editableTextMessage = event.content[@"body"];
|
||||
editableTextMessage = event.content[kMXMessageBodyKey];
|
||||
}
|
||||
|
||||
return editableTextMessage;
|
||||
@@ -4129,7 +4152,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
NSString *sanitizedText = [self sanitizedMessageText:text];
|
||||
NSString *formattedText = [self htmlMessageFromSanitizedText:sanitizedText];
|
||||
|
||||
NSString *eventBody = event.content[@"body"];
|
||||
NSString *eventBody = event.content[kMXMessageBodyKey];
|
||||
NSString *eventFormattedBody = event.content[@"formatted_body"];
|
||||
|
||||
if (![sanitizedText isEqualToString:eventBody] && (!eventFormattedBody || ![formattedText isEqualToString:eventFormattedBody]))
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
return [MatrixKitL10n messageReplyToSenderSentAFile];
|
||||
}
|
||||
|
||||
- (NSString *)senderSentTheirLocation
|
||||
{
|
||||
return [MatrixKitL10n messageReplyToSenderSentTheirLocation];
|
||||
}
|
||||
|
||||
- (NSString *)messageToReplyToPrefix
|
||||
{
|
||||
return [MatrixKitL10n messageReplyToMessageToReplyToPrefix];
|
||||
|
||||
Reference in New Issue
Block a user