Use latest user data for mention pills

This commit is contained in:
aringenbach
2022-06-16 17:07:47 +02:00
parent 87915a9e30
commit 4c8bed38c2
24 changed files with 357 additions and 97 deletions
@@ -1021,13 +1021,13 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
MXStrongifyAndReturnIfNil(self);
if (event.eventType == MXEventTypeRoomMember && event.isUserProfileChange)
{
[self refreshProfilesIfNeeded];
}
if (MXTimelineDirectionForwards == direction)
{
if (event.eventType == MXEventTypeRoomMember && event.isUserProfileChange)
{
[self refreshProfilesIfNeeded];
}
// Check for local echo suppression
MXEvent *localEcho;
if (self.room.outgoingMessages.count && [event.sender isEqualToString:self.mxSession.myUser.userId])
@@ -3668,7 +3668,10 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
while ((nextBubbleData = nextBubbleData.nextCollapsableCellData));
// Build the summary string for the series
bubbleData.collapsedAttributedTextMessage = [self.eventFormatter attributedStringFromEvents:events withRoomState:bubbleData.collapseState error:nil];
bubbleData.collapsedAttributedTextMessage = [self.eventFormatter attributedStringFromEvents:events
withRoomState:bubbleData.collapseState
andLatestRoomState:self.roomState
error:nil];
// Release collapseState objects, even the one of collapsableSeriesAtStart.
// We do not need to keep its state because if an collapsable event comes before collapsableSeriesAtStart,
@@ -4359,18 +4362,14 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
#pragma mark - Use Only Latest Profiles
/**
Refreshes the avatars and display names if needed. This has no effect
if `roomScreenUseOnlyLatestUserAvatarAndName` is disabled.
Refreshes the avatars and display names if needed.
*/
- (void)refreshProfilesIfNeeded
{
if (RiotSettings.shared.roomScreenUseOnlyLatestUserAvatarAndName)
{
@synchronized (bubbles) {
for (id<MXKRoomBubbleCellDataStoring> bubble in bubbles)
{
[bubble setRoomState:self.roomState];
}
@synchronized (bubbles) {
for (id<MXKRoomBubbleCellDataStoring> bubble in bubbles)
{
[bubble refreshProfilesIfNeeded:self.roomState];
}
}
}