mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
Revamp refreshProfiles as setRoomState
This commit is contained in:
committed by
aringenbach
parent
4eafe7fd9a
commit
1f59ed74e7
@@ -59,12 +59,12 @@
|
||||
roomId = roomDataSource.roomId;
|
||||
|
||||
MXRoomState *profileRoomState = RiotSettings.shared.roomScreenUseOnlyLatestProfiles ? roomDataSource.roomState : roomState;
|
||||
senderDisplayName = [roomDataSource.eventFormatter senderDisplayNameForEvent:event withRoomState:profileRoomState];
|
||||
senderAvatarUrl = [roomDataSource.eventFormatter senderAvatarUrlForEvent:event withRoomState:profileRoomState];
|
||||
[self setRoomState:profileRoomState];
|
||||
senderAvatarPlaceholder = nil;
|
||||
targetDisplayName = [roomDataSource.eventFormatter targetDisplayNameForEvent:event withRoomState:profileRoomState];
|
||||
targetAvatarUrl = [roomDataSource.eventFormatter targetAvatarUrlForEvent:event withRoomState:profileRoomState];
|
||||
targetAvatarPlaceholder = nil;
|
||||
|
||||
// Encryption status should always rely on the `MXRoomState`
|
||||
// from the event rather than the latest.
|
||||
isEncryptedRoom = roomState.isEncrypted;
|
||||
isIncoming = ([event.sender isEqualToString:roomDataSource.mxSession.myUser.userId] == NO);
|
||||
|
||||
@@ -107,9 +107,8 @@
|
||||
bubbleComponents = nil;
|
||||
}
|
||||
|
||||
- (void)refreshProfile
|
||||
- (void)setRoomState:(MXRoomState *)roomState;
|
||||
{
|
||||
MXRoomState *roomState = roomDataSource.roomState;
|
||||
MXEvent* firstEvent = self.events.firstObject;
|
||||
|
||||
if (firstEvent == nil || roomState == nil)
|
||||
|
||||
@@ -232,9 +232,13 @@
|
||||
- (instancetype)initWithEvent:(MXEvent*)event andRoomState:(MXRoomState*)roomState andRoomDataSource:(MXKRoomDataSource*)roomDataSource;
|
||||
|
||||
/**
|
||||
Refreshes the avatar and display name if needed. Should be used only if `roomScreenUseOnlyLatestProfiles` is enabled.
|
||||
Sets the `MXRoomState` for a buble cell. This allows to adapt the display
|
||||
of a cell with a different room state than its historical. This won't update critical
|
||||
flag/status, such as `isEncryptedRoom`.
|
||||
|
||||
@param roomState the `MXRoomState` to use for this cell.
|
||||
*/
|
||||
- (void)refreshProfile;
|
||||
- (void)setRoomState:(MXRoomState *)roomState;
|
||||
|
||||
/**
|
||||
Update the event because its sent state changed or it is has been redacted.
|
||||
|
||||
@@ -4341,7 +4341,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
@synchronized (bubbles) {
|
||||
for (id<MXKRoomBubbleCellDataStoring> bubble in bubbles)
|
||||
{
|
||||
[bubble refreshProfile];
|
||||
[bubble setRoomState:self.roomState];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user