Skip to content

Commit

Permalink
MXRoom: Improve reply message building.
Browse files Browse the repository at this point in the history
  • Loading branch information
SBiOSoftWhare committed Jul 13, 2022
1 parent 55ae735 commit 65ba5b1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions MatrixSDK/Data/MXRoom.m
Original file line number Diff line number Diff line change
Expand Up @@ -2172,22 +2172,18 @@ - (void)getReplyContentBodiesWithEventToReply:(MXEvent*)eventToReply
NSString *question = [MXEventContentPollStart modelFromJSON:eventToReply.content].question;

senderMessageBody = question;
senderMessageFormattedBody = senderMessageBody;
}
else if (eventToReply.eventType == MXEventTypeBeaconInfo)
{
senderMessageBody = stringLocalizer.senderSentTheirLiveLocation;
senderMessageFormattedBody = senderMessageBody;
}
else if (eventToReply.location)
{
senderMessageBody = stringLocalizer.senderSentTheirLocation;
senderMessageFormattedBody = senderMessageBody;
}
else if (eventToReply.eventType == MXEventTypeBeaconInfo)
{
senderMessageBody = stringLocalizer.senderSentTheirLiveLocation;
senderMessageFormattedBody = senderMessageBody;
}
else if ([msgtype isEqualToString:kMXMessageTypeText]
|| [msgtype isEqualToString:kMXMessageTypeNotice]
Expand All @@ -2208,34 +2204,35 @@ - (void)getReplyContentBodiesWithEventToReply:(MXEvent*)eventToReply
else if ([msgtype isEqualToString:kMXMessageTypeImage])
{
senderMessageBody = stringLocalizer.senderSentAnImage;
senderMessageFormattedBody = senderMessageBody;
}
else if ([msgtype isEqualToString:kMXMessageTypeVideo])
{
senderMessageBody = stringLocalizer.senderSentAVideo;
senderMessageFormattedBody = senderMessageBody;
}
else if (eventToReply.isVoiceMessage)
{
senderMessageBody = stringLocalizer.senderSentAVoiceMessage;
senderMessageFormattedBody = senderMessageBody;
}
else if ([msgtype isEqualToString:kMXMessageTypeAudio])
{
senderMessageBody = stringLocalizer.senderSentAnAudioFile;
senderMessageFormattedBody = senderMessageBody;
}
else if ([msgtype isEqualToString:kMXMessageTypeFile])
{
senderMessageBody = stringLocalizer.senderSentAFile;
senderMessageFormattedBody = senderMessageBody;
}
else
{
// Other message types are not supported
MXLogDebug(@"[MXRoom] Reply to message type %@ is not supported", msgtype);
}

if (!senderMessageFormattedBody)
{
// As formatted body is mandatory for a reply message, if no formatted body has been defined use non formatted body
senderMessageFormattedBody = senderMessageBody;
}

if (senderMessageBody && senderMessageFormattedBody)
{
*replyContentBody = [self replyMessageBodyFromSender:eventToReply.sender
Expand Down

0 comments on commit 65ba5b1

Please sign in to comment.