mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
[EventFormatter] Update room create event type processing when content has room predecessor info.
This commit is contained in:
parent
62a443f6b0
commit
eb9892704f
1 changed files with 14 additions and 9 deletions
|
@ -115,9 +115,20 @@ NSString *const kEventFormatterOnReRequestKeysLinkActionSeparator = @"/";
|
|||
}
|
||||
}
|
||||
|
||||
if (event.eventType == MXEventTypeRoomCreate && roomState.hasRoomPredecessor)
|
||||
if (event.eventType == MXEventTypeRoomCreate)
|
||||
{
|
||||
return [self roomCreatePredecessorAttributedStringFromRoomCreateContent:roomState.roomCreateContent];
|
||||
MXRoomCreateContent *createContent = [MXRoomCreateContent modelFromJSON:event.content];
|
||||
|
||||
NSString *roomPredecessorId = createContent.roomPredecessorInfo.roomId;
|
||||
|
||||
if (roomPredecessorId)
|
||||
{
|
||||
return [self roomCreatePredecessorAttributedStringWithPredecessorRoomId:roomPredecessorId];
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
NSAttributedString *attributedString = [super attributedStringFromEvent:event withRoomState:roomState error:error];
|
||||
|
@ -559,14 +570,8 @@ NSString *const kEventFormatterOnReRequestKeysLinkActionSeparator = @"/";
|
|||
|
||||
#pragma mark - Room create predecessor
|
||||
|
||||
- (NSAttributedString*)roomCreatePredecessorAttributedStringFromRoomCreateContent:(MXRoomCreateContent*)roomCreateContent
|
||||
- (NSAttributedString*)roomCreatePredecessorAttributedStringWithPredecessorRoomId:(NSString*)predecessorRoomId
|
||||
{
|
||||
if (!roomCreateContent)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *predecessorRoomId = roomCreateContent.roomPredecessorInfo.roomId;
|
||||
NSString *predecessorRoomPermalink = [MXTools permalinkToRoom:predecessorRoomId];
|
||||
|
||||
NSDictionary *roomPredecessorReasonAttributes = @{
|
||||
|
|
Loading…
Reference in a new issue