diff --git a/Riot/Modules/GlobalSearch/Files/CellData/FilesSearchCellData.m b/Riot/Modules/GlobalSearch/Files/CellData/FilesSearchCellData.m
index 606bfbe70..6e509e089 100644
--- a/Riot/Modules/GlobalSearch/Files/CellData/FilesSearchCellData.m
+++ b/Riot/Modules/GlobalSearch/Files/CellData/FilesSearchCellData.m
@@ -37,7 +37,7 @@
roomId = event.roomId;
// Title is here the file name stored in event body
- title = [event.content[@"body"] isKindOfClass:[NSString class]] ? event.content[@"body"] : nil;
+ title = [event.content[kMXMessageBodyKey] isKindOfClass:[NSString class]] ? event.content[kMXMessageBodyKey] : nil;
// Check attachment if any
if ([searchDataSource.eventFormatter isSupportedAttachment:event])
diff --git a/Riot/Modules/MatrixKit/Controllers/MXKRoomViewController.m b/Riot/Modules/MatrixKit/Controllers/MXKRoomViewController.m
index 24d8c8f1f..942eeec58 100644
--- a/Riot/Modules/MatrixKit/Controllers/MXKRoomViewController.m
+++ b/Riot/Modules/MatrixKit/Controllers/MXKRoomViewController.m
@@ -2184,7 +2184,7 @@
NSString* textMessage;
if ([msgtype isEqualToString:kMXMessageTypeText])
{
- textMessage = event.content[@"body"];
+ textMessage = event.content[kMXMessageBodyKey];
}
// Show a confirmation popup to the end user
diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKAttachment.m b/Riot/Modules/MatrixKit/Models/Room/MXKAttachment.m
index a2d796e68..634ca547f 100644
--- a/Riot/Modules/MatrixKit/Models/Room/MXKAttachment.m
+++ b/Riot/Modules/MatrixKit/Models/Room/MXKAttachment.m
@@ -119,7 +119,7 @@ NSString *const kMXKAttachmentFileNameBase = @"attatchment";
}
}
- MXJSONModelSetString(_originalFileName, eventContent[@"body"]);
+ MXJSONModelSetString(_originalFileName, eventContent[kMXMessageBodyKey]);
MXJSONModelSetDictionary(_contentInfo, eventContent[@"info"]);
MXJSONModelSetMXJSONModel(contentFile, MXEncryptedContentFile, eventContent[@"file"]);
diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m
index 884cd439b..c07fcdce9 100644
--- a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m
+++ b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m
@@ -3992,7 +3992,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
}
else
{
- editableTextMessage = event.content[@"body"];
+ editableTextMessage = event.content[kMXMessageBodyKey];
}
return editableTextMessage;
@@ -4109,7 +4109,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]))
diff --git a/Riot/Modules/MatrixKit/Models/Search/MXKSearchCellData.m b/Riot/Modules/MatrixKit/Models/Search/MXKSearchCellData.m
index 246dbd87d..d1daa83ad 100644
--- a/Riot/Modules/MatrixKit/Models/Search/MXKSearchCellData.m
+++ b/Riot/Modules/MatrixKit/Models/Search/MXKSearchCellData.m
@@ -56,7 +56,7 @@
date = [searchDataSource.eventFormatter dateStringFromEvent:searchResult.result withTime:YES];
// Code from [MXEventFormatter stringFromEvent] for the particular case of a text message
- message = [searchResult.result.content[@"body"] isKindOfClass:[NSString class]] ? searchResult.result.content[@"body"] : nil;
+ message = [searchResult.result.content[kMXMessageBodyKey] isKindOfClass:[NSString class]] ? searchResult.result.content[kMXMessageBodyKey] : nil;
}
return self;
}
diff --git a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m
index 923fbbaa7..46abe46ab 100644
--- a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m
+++ b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m
@@ -139,7 +139,7 @@ static NSString *const kHTMLATagRegexPattern = @"([^<]*)";
if (event.eventType == MXEventTypeRoomMessage)
{
NSString *msgtype;
- MXJSONModelSetString(msgtype, event.content[kMXMessageTypeKey]);
+ MXJSONModelSetString(msgtype, event.content[@"msgtype"]);
NSString *urlField;
NSDictionary *fileField;
@@ -1263,12 +1263,12 @@ static NSString *const kHTMLATagRegexPattern = @"([^<]*)";
else if (eventThreadIdentifier)
{
isHTML = YES;
- MXJSONModelSetString(body, event.content[@"body"]);
+ MXJSONModelSetString(body, event.content[kMXMessageBodyKey]);
MXEvent *threadRootEvent = [mxSession.store eventWithEventId:eventThreadIdentifier
inRoom:event.roomId];
NSString *threadRootEventContent;
- MXJSONModelSetString(threadRootEventContent, threadRootEvent.content[@"body"]);
+ MXJSONModelSetString(threadRootEventContent, threadRootEvent.content[kMXMessageBodyKey]);
body = [NSString stringWithFormat:@"In reply to %@
%@
%@",
[MXTools permalinkToEvent:eventThreadIdentifier inRoom:event.roomId],
[MXTools permalinkToUserWithUserId:threadRootEvent.sender],
@@ -1279,7 +1279,7 @@ static NSString *const kHTMLATagRegexPattern = @"([^<]*)";
}
else
{
- MXJSONModelSetString(body, event.content[@"body"]);
+ MXJSONModelSetString(body, event.content[kMXMessageBodyKey]);
}
if (body)
@@ -1561,7 +1561,7 @@ static NSString *const kHTMLATagRegexPattern = @"([^<]*)";
else
{
NSString *body;
- MXJSONModelSetString(body, event.content[@"body"]);
+ MXJSONModelSetString(body, event.content[kMXMessageBodyKey]);
// Check sticker validity
if (![self isSupportedAttachment:event])
@@ -2100,7 +2100,7 @@ static NSString *const kHTMLATagRegexPattern = @"([^<]*)";
else if (!_isForSubtitle && event.eventType == MXEventTypeRoomMessage && (_emojiOnlyTextFont || _singleEmojiTextFont))
{
NSString *message;
- MXJSONModelSetString(message, event.content[@"body"]);
+ MXJSONModelSetString(message, event.content[kMXMessageBodyKey]);
if (_emojiOnlyTextFont && [MXKTools isEmojiOnlyString:message])
{
diff --git a/Riot/Modules/Room/CellData/RoomBubbleCellData.m b/Riot/Modules/Room/CellData/RoomBubbleCellData.m
index b3a388b27..3d69115f1 100644
--- a/Riot/Modules/Room/CellData/RoomBubbleCellData.m
+++ b/Riot/Modules/Room/CellData/RoomBubbleCellData.m
@@ -1066,7 +1066,7 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
{
NSString *mediaName = [self accessibilityLabelForAttachmentType:self.attachment.type];
- MXJSONModelSetString(accessibilityLabel, self.events.firstObject.content[@"body"]);
+ MXJSONModelSetString(accessibilityLabel, self.events.firstObject.content[kMXMessageBodyKey]);
if (accessibilityLabel)
{
accessibilityLabel = [NSString stringWithFormat:@"%@ %@", mediaName, accessibilityLabel];
diff --git a/RiotNSE/NotificationService.swift b/RiotNSE/NotificationService.swift
index b3ef5bd61..554780752 100644
--- a/RiotNSE/NotificationService.swift
+++ b/RiotNSE/NotificationService.swift
@@ -386,7 +386,7 @@ class NotificationService: UNNotificationServiceExtension {
}
let msgType = event.content[kMXMessageTypeKey] as? String
- let messageContent = event.content["body"] as? String
+ let messageContent = event.content[kMXMessageBodyKey] as? String
let isReply = event.isReply()
if isReply {
diff --git a/RiotSwiftUI/Modules/Template/TemplateAdvancedRoomsExample/TemplateRoomChat/Service/MatrixSDK/TemplateRoomChatService.swift b/RiotSwiftUI/Modules/Template/TemplateAdvancedRoomsExample/TemplateRoomChat/Service/MatrixSDK/TemplateRoomChatService.swift
index dfb295384..821f4ccac 100644
--- a/RiotSwiftUI/Modules/Template/TemplateAdvancedRoomsExample/TemplateRoomChat/Service/MatrixSDK/TemplateRoomChatService.swift
+++ b/RiotSwiftUI/Modules/Template/TemplateAdvancedRoomsExample/TemplateRoomChat/Service/MatrixSDK/TemplateRoomChatService.swift
@@ -103,7 +103,7 @@ class TemplateRoomChatService: TemplateRoomChatServiceProtocol {
})
.compactMap({ event -> TemplateRoomChatMessage? in
guard let eventId = event.eventId,
- let body = event.content["body"] as? String,
+ let body = event.content[kMXMessageBodyKey] as? String,
let sender = senderForMessage(event: event)
else { return nil }
diff --git a/RiotTests/MatrixKitTests/MXKEventFormatterTests.m b/RiotTests/MatrixKitTests/MXKEventFormatterTests.m
index 320e82b43..440022c84 100644
--- a/RiotTests/MatrixKitTests/MXKEventFormatterTests.m
+++ b/RiotTests/MatrixKitTests/MXKEventFormatterTests.m
@@ -52,7 +52,7 @@
anEvent.wireType = kMXEventTypeStringRoomMessage;
anEvent.originServerTs = (uint64_t) ([[NSDate date] timeIntervalSince1970] * 1000);
anEvent.wireContent = @{ kMXMessageTypeKey: kMXMessageTypeText,
- @"body": @"deded" };
+ kMXMessageBodyKey: @"deded" };
maxHeaderSize = ceil(eventFormatter.defaultTextFont.pointSize * 1.2);
}